Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-12-2007, 04:02 PM
Member
 
Join Date: Nov 2007
Posts: 35
java_fun2007 is on a distinguished road
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??

thanks
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-12-2007, 10:20 PM
Member
 
Join Date: Nov 2007
Posts: 35
java_fun2007 is on a distinguished road
Do I need an abstract class?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-12-2007, 11:56 PM
Member
 
Join Date: Aug 2007
Posts: 30
dmacvittie is on a distinguished road
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 -
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 12-13-2007, 02:36 PM
Member
 
Join Date: Nov 2007
Posts: 35
java_fun2007 is on a distinguished road
yeah I guess I should add inheritance between those two classes too

Thanks for you help!

Dan
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delegation vs inheritance javaplus Advanced Java 1 12-07-2007 10:07 PM
Inheritance mew New To Java 1 12-07-2007 07:08 PM
Multiple Inheritance mew New To Java 1 12-01-2007 11:04 PM
Inheritance by examle JavaForums Java Blogs 0 11-19-2007 01:02 AM
Inheritance in GUI Marty SWT / JFace 2 05-11-2007 01:54 AM


All times are GMT +3. The time now is 04:42 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org