Classes and OOP
Classes are a way to group data and provide the functionality to manipulate that data. A class type is the C++ representation of an object. A class is essentially synonymous with an object. In the previous chapter, the Track
class was an archetype of an object of type Track
.
Note
The term archetype is a descriptive term to facilitate explanation, and is not an official term.
The word archetype is important to note as it implies the concept of reusability, one of the main benefits of an object-oriented design approach. Once an object has its archetypal foundations, then the specifics can be exposed to manipulation without changing the underlying description. An object built with its own specifics (data) from an archetype (class) is known as an instance of an object or class.
Here is the Track
class that was used in the preceding chapter:
#include <iostream> #include <string> using namespace std; class Track { public: ...