Casting objects across parent classes.
I have two classes named PolicyType under different packages
Both are bascially the same but belong to differnet parent Classes.
I have an abstract class method which processes these classes( bascally some set operations)
I want to call this method from a class extending this abstract class.
However the method in the abstract class dosent know which class it needs to use.
My method looks like
public void method ( Object obj){
}
I can get the right class from the object by using obj.getClass();
but then I want to cast obj to the right class and use the object based on the class which called it.
Could anyone point me as to how i can do it?
I want to basically do somethig like this
public void method ( Object obj){
Class cls= obj.getclass();
cls obj1 = (cls) obj;
}
Thanks in advance

