Composition

Building an object out of other objects it owns ("has-a").

What is Composition?

Composition means building an object out of other objects. A Car has an Engine and has four Wheels. The parts are usually created and owned by the whole.

public class Car
{
    private readonly Engine engine = new();
    private readonly Wheel[] wheels = { new(), new(), new(), new() };

    public void Start() => engine.Start();
}

Level: Journeyman · More OOP terms at this level

Updated

In other subjects