7. When a class contains objects of another class, the relationship is called a whole-part relationship or composition. The relationship created is also called a has-a relationship. Discuss some of the possible issues with composition, such as the long statement: Outputsales.getHighestPaidEmployee().getHireDate().getYear().
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
7. When a class contains objects of another class, the relationship is called a whole-part relationship or composition. The relationship created is also called a has-a relationship. Discuss some of the possible issues with composition, such as the long statement: Outputsales.getHighestPaidEmployee().getHireDate().getYear().

COMPOSITION:
- Composition is basically a concept of Object Oriented Programming in which classes achieve the polymorphism and code reusability without the using the concept of inheritance from any base class.
- In composition, interfaces are created which is the task which is not performed in the case of inheritance, here interface is used to represent the behavior of that particular system.
- These interfaces which are created in the composition of the classes are used to enable the polymorphic property for that classes and its objects.
- This composition property is used to enable the has-a-association between all the objects which are present of that particular class.
- Composition is basically used to design the APIs for further use.
Step by step
Solved in 2 steps









