posted 18 years ago
Any subclass can act as parent class. Let's say if you have parent class P and you have two classes extending parent class(C1,C2).
You can typecast back to C1 or C2 to P and call methods belong to P.
In your case, you can typecast from parent to child or child to parent.
But not from C1 to C2 or viceversa.
If change desing as C2 extending C1, C1 extending P, You can call C1 methods from C2. Or
You can use reference of C2 in C1 to call methods on C2.