Tuesday, August 3, 2010

Abstract Class vs. Interface in C#

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

Related Posts
Abstract Class In C#
Sealed Class In C#
Interface In C#
Abstract Class vs. Interface in C#
NET framework Comparison
C# Interview Questions

No comments:

Post a Comment