Results 1 to 4 of 4
Thread: inheritance and aggregation
- 12-12-2007, 03:02 PM #1
Member
- Join Date
- Nov 2007
- Posts
- 35
- Rep Power
- 0
inheritance and aggregation
hi,
I have a question about this relation
http://img143.imageshack.us/img143/1...problemeq3.png
Class A has aggregation relationship with Class B
Class B has aggregation relationship with Class C
Class B has Inheritance relationship with Class D
Class D has aggregation with Class E
Class C and Class E have almost the same attributes and methods, is that mean that Class E has extended the Inheritance too or should I write the attributes and methods again?? :confused:
thanks
- 12-12-2007, 09:20 PM #2
Member
- Join Date
- Nov 2007
- Posts
- 35
- Rep Power
- 0
Do I need an abstract class? :rolleyes:
- 12-12-2007, 10:56 PM #3
Member
- Join Date
- Aug 2007
- Posts
- 30
- Rep Power
- 0
Not an easy question to answer with the information you have provided. If all of C is in E or all of E is in C, then yes, making one a subclass of the other makes sense in most cases.
Aggregations don't generally need any form of relationship - the relationship is defined by the fact that one holds a collection of the other.
Hope that helps!
Don.Don MacVittie F5 Networks - DevCentral
- 12-13-2007, 01:36 PM #4
Member
- Join Date
- Nov 2007
- Posts
- 35
- Rep Power
- 0
Similar Threads
-
Delegation vs inheritance
By javaplus in forum Advanced JavaReplies: 1Last Post: 12-07-2007, 09:07 PM -
Inheritance
By mew in forum New To JavaReplies: 1Last Post: 12-07-2007, 06:08 PM -
Multiple Inheritance
By mew in forum New To JavaReplies: 1Last Post: 12-01-2007, 10:04 PM -
Inheritance in GUI
By Marty in forum SWT / JFaceReplies: 2Last Post: 05-11-2007, 12:54 AM


LinkBack URL
About LinkBacks

Bookmarks