Interface

D

DBC User

Hi All,

I have a simple beginer question. What is the real use of interface in
c#. I am not getting the use of it.

I can declare a class as interface and declare all the methods that
need to be implemented. 'Now if you want to use the interface', put
them as a derived class and implement all the methods. So far is good.
Now when do I need this type of feature?(If you want to derive more
than one class then interface is the answer. Is there any other
reason?)

Also, if I want to derive the same interface in more than one class, I
would be rewriting the same implementation twice or as much it is used.
Does it make redudent code management and doesn't it defeat the real
feature of OOP?

I am sure there is a valid answer and I am missing it. I really like to
know the use for it, I feel like I am not using a good feature of C#
just because I don't know it.

Thanks.
DBCuser.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top