Sunday 19 August 2018

C#: Abstract class Vs Interfaces


a.   An abstract class can have implementation for some (or) all the methods of it. But all the methods in interfaces are abstract (they don’t have any implementation).

b.   Interfaces can’t have member variables, where as an abstract class can have zero (or) more member variables.

c.   Interface members are public by default and they don’t take any other access modifiers. Abstract class member functions can use any access modifier.

d.   An interface can inherit from more than one interface. An abstract class can inherit from other interfaces (or) other abstract class.

e.   A class can implement multiple interfaces, whereas a class can inherit from one abstract class.




Previous                                                 Next                                                 Home

No comments:

Post a Comment