Aggregation, composition, and nested classes

When a class inherits another class, we often say that the child class is a kind of parent class. If a car takes the benefits of a vehicle class, for example, we say that a car is a kind of vehicle. In inheritance, classes always have an is-a relationship. In this section, we will discuss two more important topics related to object-oriented programming, in which classes have a has-a relationship instead. These concepts are aggregation and composition. Let's start by looking at aggregation.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.27.251