public class InheritImpl implements Inherit {
public ObjectInfo getObject(int type) {
ObjectInfo info = new ObjectInfo();
info.setType("Type: " + type);
BaseType ba = null;
switch (type) {
case 0:
ba = new SubTypeA();
ba.setName("A");
((SubTypeA)ba).setAvalue("A");
break;
case 1:
ba = new SubTypeB();
ba.setName("B");
((SubTypeB)ba).setBvalue("B");
break;
default:
}
info.setBaseObject(ba);