| Author |
what is the code trying to say between inheritance and aggregation?
|
sura watthana
Ranch Hand
Joined: Sep 13, 2004
Posts: 77
|
|
Hi, I'm trying to figure out what the code below trying to say about the different between inheritance and aggregation. could somebody tell me, please? Thank you. (added [C0DE][/C0DE] tags ) [ September 14, 2004: Message edited by: Barry Gaunt ]
|
 |
Fletcher Estes
Ranch Hand
Joined: Jul 01, 2004
Posts: 108
|
|
Aggregation means a collection of properties which defines a class. Your QueueByAggregation demonstrates this because it has a member variable (or property/attribute) which is the previously defined LinkedList. The nature of the QueueByAggregation is determined by what it is composed of, rather than what it is natively. Inheritance means a class is a type of a superclass. In this case, your StackByInheritance is a type of LinkedList. It can do anything a LinkedList can do, and may be treated as a LinkedList by other classes. The StackByInheritance doesn't have a LinkedList, like the QueueByAggregation, it simply is one. Hope this helps
|
 |
 |
|
|
subject: what is the code trying to say between inheritance and aggregation?
|
|
|