Class Inheritance and Type Casting: Class Inheritance: An Object Can Belong To Multiple Types. Object of
Class Inheritance and Type Casting: Class Inheritance: An Object Can Belong To Multiple Types. Object of
Subclass Point
Class Line
Geometric Figure
Section Section
ESC101Student
IITKStudent Rollno
Subclass
typecast
Superclass
o = new Indian();
o.Name; //Correct
o.Section //Incorrect
o.Rollno; //Incorrect
ESC101Student e;
e = o; // if o is not object of ESC101Student then this results in error
o = e; //Correct for any object type of o because of type cast