A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java different type of relationship among classes
Joined: Apr 05, 2012
Jan 03, 2013 07:13:28
i am confused about what are different relationship termed when
1) when a class extends another class
2) when a class implements interface
3) when a class have another class object as data member
are there any other kind of relationship?
I also found this
Has-A Relationship at codeRanch
, but answers here confuse more than before
Joined: Apr 06, 2010
Jan 03, 2013 07:32:32
1 and 2 are both IS-A relationships, whereas 3 is usually termed a HAS-A relationship.
I'd say there are also relationships when:
- a class creates an instance of another class
- a class has a method taking a parameter of another class
- a class has a method returning an instance of another class
I'm not sure I've heard specific names for those relationships, though. Maybe "USES"?
Joined: Oct 13, 2005
Jan 03, 2013 07:37:59
Not quite sure what you want. Do you simply want to know what they are called?
This YouTube link
seems promising, I have only watched the first 5 minutes.
Have you checked out
subject: Java different type of relationship among classes
Class and Interface Relation
Is-A relationship Doubt
... if code defines an is-a relationship
Enthuware: relationship is-like-a
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015