filmov
tv
Java Programming upcasting and downcasting

Показать описание
Upcasting and Downcasting of objects can be done the way we do for primitives
type casing parent object to child object is called downcasting
downcasting for objects : Child child_obj = (child) parent_object
downcating for primitives : int num = (int) double_value
type casing child object to parent object is called upcasting
upcasting for objects : Parent parent_obj = (Parent) child_object
downcating for primitives : double num = (double) int_value
type casing parent object to child object is called downcasting
downcasting for objects : Child child_obj = (child) parent_object
downcating for primitives : int num = (int) double_value
type casing child object to parent object is called upcasting
upcasting for objects : Parent parent_obj = (Parent) child_object
downcating for primitives : double num = (double) int_value