Question
Which type of relationship between classes in OOP is
best represented when one class is a part of another class but can exist independently?Solution
Aggregation is a type of association that represents a "whole-part" relationship between two classes. The key characteristic is that the part (child object) can exist independently of the whole (parent object). For instance, in a Team class and Player class, a Player can exist without being associated with a Team . Aggregation is implemented by using references, where one class has an attribute referencing another class. This design principle promotes flexibility and modularity. Aggregation is often represented with a hollow diamond in UML diagrams. Why Other Options Are Wrong Option B : "Inheritance" Inheritance represents an "is-a" relationship, not a "whole-part" relationship. It is used to share functionality between classes, not to model part-whole dependencies. Option C : "Composition" Composition is similar to aggregation but with a crucial difference: the part cannot exist independently of the whole. For example, a Car and its Engine share a composition relationship because an engine has no meaning outside the car. Option D : "Association" Association is a broader concept that describes any relationship between classes. Aggregation is a specific type of association. Option E : "Polymorphism" Polymorphism is unrelated to class relationships and focuses on method behavior.
The system based on individual leadership is a __________ system.
What does the Svamitva Scheme aim to provide to significant tribal populations? Â
The SI number of electrical resistivity is-
In which year India won gold in men’s hockey in the Olympic games?
What will be the speed of petaFLOP Super computer that India is going to launch to enhance weather forcast at block level?
In which state of India is the Gol Gumbaz situated?
Which of the following statements is true about Aatma Nirbhar Bharat Abhiyaan?
(1) The scheme was announced in four tranches by the Prime Ministe...
In which state is the Madai Festival celebrated?
In 2016, ISRO conducted 1st satellite-based warning system trial for Indian Railways in-
As per the Indiana Discrimination Report 2022, the Labour Force Participation Rate (LFPR) of women in India is just ____ percent in 2021.