views:

79

answers:

4

Well till now I knew we implement interfaces , but today some body (you know who , i guess)) told me that If I write a interface then we implement it in class , but if it is a system Interface , Let's say INotifyPropertyChanged , the we call it Class A inherits Interface INotifyPropertyChanged.

Though I feel right , I am not sure and unsure how to explain it to him.

I need to specify in my Design doucment . So wondering what shall I mention, Inherit or Implemet.

+3  A: 

We inherit it to implement it. What's the problem?

ybungalobill
@ybungalobill,I need to specify in my Design doucment . So wondering what shall I mention, Inherit or Implemet.
@user443144: implementing. Inheritance is a detail of implementation.
ybungalobill
+1  A: 

1-Interface is implemented by a class whether is it a normal interface or system interface.

2- One Interface can inherit another interface.

saurabh
+1  A: 

Speaking language-independant you would say "implementing an interface". The symbol in UML names it the same (there is a special implementing-arrow which is used for interfaces instead of the inheriting-arrow)
Anybody understanding UML would understand what you're meaning.

In C++ you have to consider that there aren't interfaces as they exist in other languages. A interface is a pure virtual class. So classes which "use" this interface are strictly speaking inheriting from a pure virtual class. If you're saying "MyClass inherits the pure virtual class IClass" someone C++-related would understand that you mean interface I think. He also would understand if you say "MyClass is implementing IClass" and in background think of a pure virtual class.

MOnsDaR
A: 

If Class A provides the method bodies (that is, code) for the methods that are declared in the interface, then Class A is implementing the interface.

In C++, because of the lack of distinction between interface and class, the source code syntax for inheriting from a class and implementing an interface is the same. Hence the confusion.

rwong