Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
In this section, I will discuss the relative advantages and disadvantages of using inheritance and composition. Both relationships are client-server relationships. A derived class is a client of the base class, and the base class is a server of the derived class. A composite class is a client of its component class, and the component class is a server of the composite class. This means that you are going to see significant similarities between C++ programs built with alternative design techniques.
The common feature of different design solutions is the division of work between the client and the server classes, be it with the use of composition or any other design techniques. This means that the server class has to be implemented before the client class can be designed. Hence, the techniques, which are discussed in this section, can be used both for program development and for program evolution.