Composition

If inheritance is about being another class/interface, composition is about using one.

when a Field’s type is a class, the field will hold a reference to another object, thus creating an association relationship between them. Let’s intuitively define composition as when the class uses another object to provide some or all of its functionality.


Backlinks