converting sub class derived datatype into super class derived datatype is known as auto upcasting .
it is done by compiler automatically.
Object class is super class of all the classes.
Example 1:-
in this C is subclass to B and A is sub class to C.
so A(sub class) is automatically up casted to C(super class).
A is automatically upcasted to B.
lower datatype is automatically casted to upper type.
it is done by compiler automatically.
Object class is super class of all the classes.
Example 1:-
so A(sub class) is automatically up casted to C(super class).
A is automatically upcasted to B.
lower datatype is automatically casted to upper type.
\
No comments :
Post a Comment