W
www
Hi,
I am puzzled here by an inheritance question:
I have 3 classes:
public Parent {
...
}
public ChildA extends Parent {
...
//void doA() {
...
}
}
public ChildB extends Parent {
...
//void doB() {
...
}
}
Now, I am trying to use the classes above.
public Base {
protected _person;
...
}
public Sub extends Base {
_person = new ChildA();
_person.doA(); //WRONG !!!! error message: doA() is unresolved
}
I ran into this problem in my real application. What should I do? Some
type casting to force _person as ChildA ?
Thank you!!
I am puzzled here by an inheritance question:
I have 3 classes:
public Parent {
...
}
public ChildA extends Parent {
...
//void doA() {
...
}
}
public ChildB extends Parent {
...
//void doB() {
...
}
}
Now, I am trying to use the classes above.
public Base {
protected _person;
...
}
public Sub extends Base {
_person = new ChildA();
_person.doA(); //WRONG !!!! error message: doA() is unresolved
}
I ran into this problem in my real application. What should I do? Some
type casting to force _person as ChildA ?
Thank you!!