Jump to content


Photo

Reg "is A" And "has A" Relationship


  • Please log in to reply
No replies to this topic

#1 Thennam Pandian

Thennam Pandian

    New Member

  • Members
  • Pip
  • 3 posts

Posted 28 August 2011 - 09:12 PM

Hi,

I have seen a class has "is a" and "has a" relationship with one class. Is that a correct design? If it is correct, let me know the advantage of that design? On what scenario, we need to use this design?

The skeleton of the code :


Class A
{
  public void doSomeAction()  {}
}

Class B extends A
{ 
  private A obj;
 
  public void doSomeAction()  
  {
    obj.doSomeAction();
  }
}

Edited by Thennam Pandian, 28 August 2011 - 09:14 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users