Difference between interface and abstract class c#
Interface Abstract Class
1. Interface is by-default ‘Public’. 1. Abstract class is by-default ‘Private’.
2. Interface have declaration only, 2. Abstract class can have declaration and
it contains only methods declaration. and implementation part, it can have fields also.
3. Interface cannot be implementing partially. 3. Abstract class can be implementing partially.
4. An interface can inherit from another interface 4. An abstract class can inherit from another abstract
only and cannot inherit form an abstract class. class or another interface.
5. Class can inherit multiple interfaces at the 5. Class cannot inherit multiple classes at the same
same time. time.
6. An interface cannot have Access Specifiers. 6. An abstract can have Access Specifiers.
No comments:
Post a Comment