SOFTWARE DESIGN
OBJECT ORIENTED DESIGN
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
A “has a” relationship is the best description for:
|
Polymorphism
|
|
Composition
|
|
Aggregation
|
|
Inheritance
|
Explanation:
Detailed explanation-1: -When an object A contains a reference to another object B or we can say Object A has a HAS-A relationship with Object B, then it is termed as Aggregation. Aggregation helps in reusing the code. Object B can have utility methods and which can be utilized by multiple objects.
Detailed explanation-2: -Aggregation is based is on “has-a” relationship.
Detailed explanation-3: -Composition is a term where we declare the object of one class as a data member inside another class. In simple words, a relationship where an object has a reference to another instance of the same class or has a reference to an object of another class is called composition or has-a-relation in Java.
There is 1 question to complete.