Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL
Help

Class Design and Inheritance - Pg. 55

Class Design and Inheritance The most important single aspect of software development is to be clear about what you are trying to build. --Bjarne Stroustrup What kinds of classes does your team prefer to design and build? Why? Interestingly, most of the Items in this section are motivated primarily or exclusively by dependency management. For example, inheritance is the second-strongest rela- tionship you can express in C++, second only to friend; it should come as no sur- prise, then, that it's important to use such a powerful tool judiciously, correctly, and well. In this section, we focus on the key issues in class design, from minimalism to ab- straction, from composition to inheritance, from virtual to nonvirtual, from public to private, from new to delete: How to get them right, how not to get them wrong, how to avoid the subtle pitfalls, and especially how to manage dependencies. In the section after this one, we'll narrow our focus specifically to the Big Four spe- cial member functions: Default construction, copy construction, copy assignment, and destruction. Our vote for the most valuable Item in this section goes to Item 33: Prefer minimal classes to monolithic classes. 55