COMP2247 - Algorithms and Data Structures

Syllabus Software Installation Assignments Tests
Lectures and Labs
**Back to Full Menu**

OOP - Aggregation Delivery Program
Address.java
Person.java
MyDate.java
Parcel.java
DeliveryClient.java
Course Program
Book.java
Instructor.java
Student.java
MyDate.java
Course.java
CourseClient.java
Parking Ticket Program
Car.java
Officer.java
ParkingMeter.java
MyDate.java
Ticket.java
ParkingTicketClient.java




Aggregation


In this section, we study aggregation.

Concept

Aggregation is also called composition. It is a way to relate multiple classes.

Basically, data members of a class are objects of other classes.

The relationship between these objects is “has-a” relation.

Examples

A vehicle has a brake and a steering wheel.

A Vehicle object has a Brake object and a Steering Wheel object as data members.

An employee has a department.

An Employee object has a Department object as the member.

A course has a teacher, book, and student list.

A Course object has a teacher object, Book object, and Student List object as data members.