Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need of interfaces in c#

Tags:

c#

interface

What is need of interfaces in c# ? as we are writing abstract method in interfaces. instead of that we can directly implement those methods in class.

like image 437
kedar kamthe Avatar asked Dec 08 '22 05:12

kedar kamthe


1 Answers

Interfaces don't support implementation, so you cannot supply any default implementations as you can with abstract classes. Additionally, interfaces are not restricted to hierarchies, so they are more flexible than abstract classes.

like image 95
Brian Rasmussen Avatar answered Jan 05 '23 04:01

Brian Rasmussen