What is an abstract class?

A class that cannot be instantiated. A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden. Essentially, it is a blueprint for a class without any implementation.

Showing Answers 1 - 3 of 3 Answers

John

  • May 3rd, 2005
 

The abstract modifier can be used with classes, methods, properties, indexers, and events. 
 
Use the abstract modifier in a class declaration to indicate that a class is intended only to be a base class of other classes. 
 
Abstract classes have the following features:  
 
An abstract class cannot be instantiated.  
An abstract class may contain abstract methods and accessors.  
It is not possible to modify an abstract class with the sealed modifier, which means that the class cannot be inherited.  
A non-abstract class derived from an abstract class must include actual implementations of all inherited abstract methods and accessors.  
Use the abstract modifier in a method or property declaration to indicate that the method or property does not contain implementation. 
 
Abstract methods have the following features:  
 
An abstract method is implicitly a virtual method.  
Abstract method declarations are only permitted in abstract classes.  
Because an abstract method declaration provides no actual implementation, there is no method body; the method declaration simply ends with a semicolon and there are no braces ({ }) following the signature. For example:  
public abstract void MyMethod();

  Was this answer useful?  Yes

puneeth

  • Mar 16th, 2006
 

well john

 ur 99%correct but u went wrong in stating that the abstract classes can not be inherited.fact is they can b inheritedand we cant create the object for the abstract method of abstract class.but v canrefer them.

ex:   

  Was this answer useful?  Yes

Shiv

  • Sep 7th, 2006
 

Abstarct Class:

Abstract class is a class, which consist at least one pure virtuall function.

a pure virtual fuction is a fuction with no body and ia declered with the keyword Virtual and initialised to zero (0).

ex: virtual void Display()=0;

here zero(0) means is to simply tell the compiler that this function will be pure and have no body.

Note: we can not create the instance of the abstract base class. it is used only for creating child classes only.

i think it will help

Shiva

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions