Hi,
first sorry for my english...
I have a problem. I have two classes : father class (Father) and a subclass (Son) that inherits from Father.
In another class i declare :
int flag;
Father father = getRightClass();
//further code here
public Father getRightClass(){flag == 0 ? new Father(): new Son();}
Now How can i create two overloaded methods (es. method(Father) and method(Son) ) to get correctly object, if it is the refernce type that discriminates what method will be called?
And declare an object with an instance type that is a subclass of reference type is polimorphism?
Thanks.