Treating Similar Classes
Our programs model a variety of real-life objects through their data (object state) and operations (object behavior). This is a mantra of object-oriented design, but it is up to each designer to decide what to include in each class. The modeling of real-life entities should ideally reflect "common features" among real objects, for example, among inventory items, event counters, or bank accounts.
These "common features" are of course in the eye of the beholder, and C++ has different mechanisms for representing different degrees of similarity among entities.
The first mechanism that C++ offers for capturing the common features among real-life objects is the class construct itself. We use the class construct to capture ...
Get Core C++ A Software Engineering Approach 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.