Review Questions
1: | For each of the following sets of classes, indicate whether public or private derivation is more appropriate for the second column:
class Bear class PolarBear class Kitchen class Home class Person class Programmer class Person class HorseAndJockey class Person, class Automobile class Driver |
2: | Suppose we have the following definitions:
class Frabjous { private: char fab[20]; public: Frabjous(const char * s = "C++") : fab(s) { } virtual void tell() { cout << fab; } }; class Gloam { private: int glip; Frabjous fb; public: Gloam(int g = 0, const char * s = "C++"); Gloam(int g, const Frabjous & f); void tell(); }; Given that the Gloam version of tell() should display the values of glip and fb, provide definitions for the three ... |
Get The Waite Group's C++ Primer Plus, Third Edition 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.