| Author |
IS A and HAS A Relationship
|
kiranb reddy
Greenhorn
Joined: Sep 28, 2008
Posts: 20
|
|
Hi All, Can anyone explain the exact difference between IS-A and HAS-A relationship with an example. Please help me. Thanks and Regards, Kiran
|
 |
Thomas Thevis
Ranch Hand
Joined: Sep 02, 2008
Posts: 87
|
|
Hello Kiran, try to use the search function of the forum first. You will come to threads like HAS-A relationship?. If you don't find an answer to your question, come back afterwards. Regards, Thomas
|
SCJP 5.0, SCJD in progress
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9955
|
|
an apple IS A fruit. an apple HAS A seed. a Ford Mustang IS A car a Ford Mustang HAS A windshield.
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
John Eric
Greenhorn
Joined: Nov 16, 2010
Posts: 1
|
|
consider this example:-
class A{
...
}
class B extends A{
....
}
the above code shows IS A relationship, this can be implemented as Inheritance.
Class Library{
Book b=new Book();
CD cc=new CD();
}
this shows HAS A relationship.
HAS A also know as composition.
|
 |
Nitesh Nandwana
Ranch Hand
Joined: Jun 07, 2011
Posts: 115
|
|
|
Best artical on IS-A and HAS-A relationship
|
 |
 |
|
|
subject: IS A and HAS A Relationship
|
|
|