Computer Science, asked by TbiaSamishta, 1 year ago

Explain the use of inheritance and composition or aggregation based on type of relationship between classes.

Answers

Answered by aqibkincsem
1

We can create a new class by using existing class code in inheritance. It is a parent-child relationship.


For example: Banana is a fruit. On the contrary, aggregation represents part-of relationship and here code reuse is best achieved.


For example, in a library, ‘book’ is a class. It may have strings like author and title.

Similar questions