tags:

views:

76

answers:

1

hi guys, Can anybody give brief idea of class relations?

+1  A: 

Likely the term is referring to the type of relationship between two classes, for example:

  • inheritance: class B has an is a relationship with class A when B extends A
  • composition: class B has a has a relationship with class A when B contains an instance of A in its properties
  • dependency: class B has a uses relationship with class A when B takes a reference to A and invokes some method on it
tvanfosson
Don't forget the obvious and most common: no relationship whatsoever...
Oded
Well....ok yeah sure this is *correct* and all, but it's not nearly as fun :)
Nick Craver
You're forgetting one, the hate relationship, it's when class B continuously calls the destructor on class A, no matter how much resources class A gives to class B
Jimmy Hoffa
@Nick - to be fair, I *did* vote up Jimmy Hoffa's comment.
tvanfosson