abstract classes are not support multiple inheritance
|
interface is support multiple inheritance
|
not allows creating instances
|
not allows creating instances
|
Abstract class can contain abstract methods, abstract property as well as other members (just like normal class)
|
Interface can only contain abstract methods, properties but we don’t need to put abstract and public keyword.
All the methods and properties are by default Public.
|
An abstract class may contain complete or incomplete methods
|
Interfaces can contain only the signature of a method but no body
|
abstract class can contain fields, constructors, or destructors and implement properties
|
An interface cannot contain fields, constructors, or destructors and it has only the property's signature but no implementation
|
Various access modifiers such as abstract, protected, internal, public, virtual, etc can be used
|
By default they are public so no need to define
|
Thursday, 9 August 2012
Abstract Class vs. Interface in C#
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment