Main differences of both
Abstract Class:
Interface :
Abstract Class:
- Abstract class may contain complete or incomplete methods.
- It can implement methods.
- An Abstract class can contain fields, constructors or destructors and implement properties.
- It cannot support multiple inheritance.
- It only on abstract class.
- Various access modifiers such as abstract, protected, internal, public, virtual etc.....
Interface :
- Interface can contain only the signature of the method but no body.
- It cannot implement methods.
- It cannot contain fields, constructors or destructors and it has only properties , signature but no implementation
- It support multiple inheritance.
- Class may inherit several interfaces.
- But not in interface.
Abstract classes are faster than interface.
No comments:
Post a Comment