Question

In Object-Oriented Programming, which of the following correctly demonstrates the concept of Aggregation?

A A class Car has an object of class Engine and the engine cannot exist without the car.
B A class Department contains multiple objects of class Employee which can exist independently of the department.
C A class House contains an object of class Room, and rooms cannot exist without the house.
D A class Library contains objects of class Books that cannot exist without the library.
E A class Computer contains an object of class CPU that cannot function independently of the computer.
Practice Next

Relevant for Exams:

Hey! Ask a query