What is the use of interfaces..??
what is the use of interface...???
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Santhosh Kumar43 reputationPosted Nov 25, 2016, 1:10 AM EST
First and foremost, interfaces in C# are a means to get around the lack of multiple inheritance in C#, meaning you cannot inherit from multiple classes but you can implement multiple interfaces. OOP tries to resemble how objects are defined in the real life, and interfaces are a very logical way of grouping objects in terms of behavior.
An interface is a contract between itself and any class that implements it. This contract states that any class that implements the interface will implement the interface's properties, methods and/or events. An interface contains no implementation, only the signatures of the functionality the interface provides. An interface can contain signatures of methods, properties, indexers & events.
You can think of an interface as an abstract class with the implementation stripped out. An interface doesn't actually do anything, like a class or abstract class, it merely defines what a class that implements it will do. An interface can also inherit/implement other interfaces.
Nitin SontakkeRank #264 · 9.6K reputationPosted Nov 25, 2016, 1:35 AM EST
Ramesh S84 reputationPosted Nov 25, 2016, 3:18 AM EST
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Nov 27, 2016, 1:50 AM EST