I have a class:
class MyClass { public MyClass getParent() { ... } public MyClass[] getChildren() { ... } .... }
and a subclass
Is there any way (by language or design) to avoid that casting?
The answer is No. If you want to access super class field or method than you must explicitly cast.