O'Reilly Forums: Reg "is A" And "has A" Relationship - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Reg "is A" And "has A" Relationship

#1 User is offline   Thennam Pandian 

  • New Member
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 28-August 10

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();
  }
}

This post has been edited by Thennam Pandian: 28 August 2011 - 09:14 PM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users