Polymorphism is also an important concept of object oriented concept of object oriented programming which is also in existence since the time of C++ inception. According to this concept, the object inherited methods and functions of parent class can be used in a multiple of ways in an application. This is an advanced method of inheritance.
Composition is an another important concept, which comes under the object oriented framework of coldfusion. In this process, many objects make a single object which can work by using the values of its parent objects. This object can call all the declared functions and properties and use them in a different way.
It is always necessary component to remember in the object oriented programming framework that a base class does necessarily have its own essential component which is necessarily its object. It is also called as “has a” relationship like a car-engine relationship. A car has necessarily an engine but an engine can not necessarily have a car.
One additional point of ownership can always be found from the concept of composition. A base class has complete control on the components like - methods and properties. Without it, no components can survive. Like - without a car no engine, wheels, AC is meaningful.
Aggregation is generally considered as the opposite concept of composition. Just like a car is needed to have a driver to move but the driver is not necessary to be the same person every time. In the object oriented framework, the object can reference the other objects, but they are not necessary to exist.
Hope you have liked this post ! Thanks for reading it !
reference link -