What is abstract class in c#

Abstract class is a class that contain complete and abstract (incomplete) both type of member and it can not be instantiated, Abstract classes are one of the essential behaviors provided by dotnet.

Interface contains only definition / signature of functionality, and if we have some common functionality as well as common signature then there is a need of abstract class so through abstract class we can provide behavior as well as functionality both in the same time, developer inheriting abstract class can use this functionality and need to fill only in the blank.

Abstract classes only represent as a base classes, no one can instantiate (create objects) these classes.

In C#.net We can create abstract class by the use of abstract Keyword and Abstract member by the abstract Keyword.

In Visual Basic We can create abstract class by the keyword MustInherit and Abstract member by the MustOverride Keyword

Features of a abstract class :-

  • Abstract Class (Incomplete Class)  contains both Complete or Abstract (incomplete) Members.
  •  We can not create a object of abstract class.
  • Abstract class is designed to act as a base class (to be inherited by other classes).
  • Abstract can contain Data Member and Constructors.
  • Constructor of abstract class can not be initialize directly, it can be call by derived class.
  • Incomplete Member (abstract member) of Abstract class  is implicitly virtual (it can be further overridden).
  • It also contain static member but only complete member can be static not abstract member (Static members cannot be abstract).

Recent Article