What is Abstract Class?

 Posted by Poster on 4/24/2008 | Category: OOPS Interview questions | Views: 236855

Abstract class is a class that can not be instantiated, it exists extensively for inheritance and it must be inherited. There are scenarios in which it is useful to define classes that is not intended to instantiate; because such classes normally are used as base-classes in inheritance hierarchies, we call such classes abstract classes.

Abstract classes cannot be used to instantiate objects; because abstract classes are incomplete, it may contain only definition of the properties or methods and derived classes that inherit this implements it's properties or methods.

Static, Value Types & interface doesn't support abstract modifiers. Static members cannot be abstract. Classes with abstract member must also be abstract.

For detailed example, read this article http://www.dotnetfunda.com/articles/article467-abstract-class--explained.aspx

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Raja on: 2/20/2009
Abstract classes are classes that contain one or more abstract methods (methods without implementation). An abstract method is a method that is declared, but doesn't contain implementation (like method declaration in the interface). Abstract classes can't be instantiated, and require subclasses to provide implementations for the abstract methods. This class must be inhertied. This class is mostly used as a base class.
Posted by: Poster on: 2/17/2011 | Points: 10
I think this article can also be read to understand Abstract class in C# http://www.dotnetfunda.com/articles/article1183-abstract-class-.aspx.
Posted by: Abhisekjani on: 3/22/2011 | Points: 10
An abstract class can contain both abstract and non abstract methods in it.if any of its child class wants to consume its non abstract method then it first implements all the abstract method of parent.
Posted by: Rajeshatkiit on: 12/15/2015 | Points: 10
An abstract class can be 'half-cooked' class meaning it has provided few methods with body but few methods are without body. Abstract class takes part in hierarchy of classes based on inheritance. Instance of abstract class cann't be created.

Uses of abstract class:
1. Use an abstract class to define a common base class for a family of types.
2. Use an abstract class to provide default behavior.

Login to post response