I am confused every time I read the Java Documentation again to that. So please try to help me in your own words.
List<Parent> list = new ArrayList<Parent>();
//Child extends Parent...
list.add(new Child());
...
...
for(Parent p: list){
if(p.getClass().isInstance(Child)){
Child c = (Child) p;
c.execFuncNonExistingInParent();
}
}
Just wanna proof the Objects inheritances from Parent, to avoid Cast Problems.
if(p.getClass().isInstance(Child.class))
or
if(Child.class.isInstance(p.getClass()))
Greatings Oekel