Question
What type of relationship is represented by Aggregation
in Object-Oriented Programming?Solution
Aggregation is a "has-a" relationship where one object is composed of other objects, but the lifecycle of the contained objects is independent of the containing object . For example, a Teacher class might be associated with a School class, but even if the School object is destroyed, the Teacher object can continue to exist. Aggregation emphasizes shared ownership and loosely coupled associations, making it useful for scenarios requiring flexibility in object dependencies. Why Other Options Are Incorrect :
- "Is-a" relationship : This refers to Inheritance , where a subclass derives from a parent class.
- "Has-a" relationship with exclusive ownership : This describes Composition , where the contained objects' lifecycle is tied to the container.
- Parent-child relationship : This typically relates to Inheritance or tree structures , not Aggregation.
- Object-to-object message communication : This aligns with Message Passing , which focuses on interaction between objects rather than relationships
Which organization recently completed six consecutive developmental trials of the High-Speed Expendable Aerial Target (HEAT) 'ABHYAS'?
Which of the following was recognised by Reserve Bank of India (RBI) as India’s first Self-Regulatory Organization (SRO) for the NBFC-MFIs in 2014?
Which one of the following is the best description of ‘Alycaeus himalayae’, it was in news recently?
Which ministry has launched the Swachh Survekshan Grameen (SSG) 2025?
In the RBI’s circular on hedging foreign exchange risk, what is the maximum notional amount for derivative contracts involving INR without requiring u...
An Indian Army contingent recently departed for the 13th edition of the joint military Exercise MAITREE. This exercise is conducted with which country?
The Union Cabinet has approved the expansion of 'Digital India Project' with an outlay of how many crores?
Who Honoured with Pravasi Bhartiya Samman ?Â
Where is the first ‘Niveshak Shivir’ being launched by IEPFA and SEBI?
Who were the Indian players in the men’s doubles final at the Malaysia Open Super 1000?