-- . , - . -- , .
, --, - , .
. . . .
, (, ) . - , . . .
, , , . , -, -. , , (subclass) -, - (derived class), (base class) (superclass). , - , , - .
, Bus Truck - - - , :
, , - . (upcast, ). . :
std::cout << b.getVehicle().getWeight()
<< b.getVehicle().getEngine().getHorsePower();
:
std::cout << b.getWeight() << b.getEngine().getHorsePower();
/ .