Interface in C#

If the interface in C# only contains the declaration of the methods and we need to define those methods in the class, then Why we use the interface..???

Questions by dimplesharma

Showing Answers 1 - 3 of 3 Answers

Interfaces define a contract. You should use it only if you want to support a group or related functionalities in a class or struct. Otherwise there is no need to use it.

Think about cars - they have similar functionality. That is something you'd want to define in an interface so that it is generic.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions