
Class composition
Class composition is a programming concept where a class is made up of other classes or objects, representing a "has-a" relationship. Instead of inheriting features from a parent class, one class contains instances of other classes to build complex functionality. For example, a Car class might be composed of Engine, Wheel, and Seat objects. This approach promotes modularity, reusability, and easier maintenance, as individual components can be developed, tested, and updated independently, then assembled into more complex systems.