• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
wait for your answer
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic