A Case Study

In this section we will examine a linked list in detail, as a case study it looks at how you create complex structures and, more important, how you use inheritance, polymorphism, and encapsulation to manage large projects.

Delegation of Responsibility

A fundamental premise of object-oriented programming is that each object does one thing very well and delegates to other objects anything that is not its core mission.

An automobile is a perfect example of this idea in hardware: The engine's job is to produce the power. Distribution of that power is not the engine's job; that is up to the transmission. Turning is not the job of the engine or the transmission; that is delegated to the wheels.

A well-designed machine has lots of small, ...

Get Sams Teach Yourself C++ in 24 Hours, 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.