14.10. Exercises

1: Add classes House, MotorCycle, and AirPlane to the OMT diagram in Figure 14.3 on page 675. Where would multiply-derived SeaPlane fit in? Is this the same pattern? Should class Vehicle be a virtual base?
2:Suppose you invoke the following function with a MotorHome object.
void lfunc(LandVehicle &);          // prototype
MotorHome mh(30, 120);              // create MotorHome object
lfunc(mh);                          // invoke function

What sort of conversion, if any, takes place? Does the conversion require a run-time computation? (Use Figure 14.4 on page 681 for reference.) ...

Get Navigating C++ and Object-Oriented Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.