Polymorphism
Last updated
Last updated
Summary
reference variable is child : the number of usable members is itself. if there is n members, the number of usable members is n as well.
reference variable is parent : the number of usable members is as same as parent's one. when usable members of parent is m, and usable members of child is n, in this case the number of usable members is m of n.(m<n)
Handle child type object using parent(ancestor) type reference variable. Type mismatch is allowed like below : when the relation is parent and child.
parent >= child : 5 of 7.(O)
child >= parent : 7 of 5.(X)