• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is the "implement" included in the "is a" relationship?

 
Simo Hayha
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wait for your answer
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When a class implements an interface, it agrees to fulfill the contract defined by that interface by implementing the methods declared within the interface. We can safely say that the implementing class augments its capabilities (behavior) when implementing (non-empty) interfaces. The class may then be known under different hats. For instance, if a class Test implements the interface Runnable, we can say that the class Test is_a Runnable because it provides the contract (the run() method) specified in the Runnable interface.
Anyone?
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From a practical perspective I think a class C implementing an interface i satisfy the is-a relationship. An instance of such class could be cast to i. It inherits the attributes from C. It conforms to the behaviour specified in i. Thus it can be treated as if were of type i: you can send it the same sequence of methods as you could send to an "instance" of the interface.
Maybe a OOAD expert could disagree from a theoretical view.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic