C++ Compound Objects

objects using inheritance, composition, aggregation, and using relationships

Fig 1. Class and Object Relationships

1.0 Concept

Compound Objects are composite structures built by combining classes with the four class relationships:
  • Inheritance: an "is-a" relationship
  • Composition: ownership by inclusion of one class instance by another
  • Aggregation: ownership by including of a reference of one class instance by another
  • Using: non-ownership relationship where one class uses an instance of another it did not create
Example: TextFinder
Fig 1. TextFinder Class Diagram

2.0 Build

CompoundObjects code was built with Visual Studio Community Edition - 2019 and tested on Windows 10.

3.0 Resources

CodeSnap-CompoundObjects.cpp
DesignNote-CppClassRelationships.html
Discusses some details of how the four class relationships work in C++.