Object relationship
From Rice Wiki
In OOP, interrelated objects are composed together for complex functionality. This page describes concepts that relate one object to another.
Inheritance
Implementation inheritance extends the implementation of a parent class with a child class that inherit the members of the parent class while adding/overriding certain members.
Composition
Unlike inheritance, which directly extends a parent object, composition owns the object whose functionality it wishes to extend. This solves many of the issues of inheritance.
class Owner
{
Extended ext;
public:
Owner() {
ext = Extended();
}
};
Aggregation
Similar to composition, aggregation involves an object "having" another object. The difference between the two lies in that composition focuses on a parent-child relationship, whereas Aggregation