Monday, November 19, 2012

Some Super class and sub class concepts(Polymorphism)

I f


 Some Valid obect creation....

Cone c1= new Cone();
Ctwo c2= new Ctwo();
Cone c= new Ctwo();
Object O= new Cone();
Object o= new Ctwo();


This is somewhat called as polymorphism

But from Cone object we cant access the CTwo class methods . To access the CTwo class methods,
we have to typecaste  COne object into CTwo object

Ctwo c2= (CTwo)c1;

No comments:

Post a Comment