The Abstract class reference article from the English Wikipedia on 24-Jul-2004
(provided by Fixed Reference: snapshots of Wikipedia from wikipedia.org)

Abstract class

Sponsorship the way you would do it
In computing, when specifying an abstract class, the programmer is referring to a class which has elements that are meant to be implemented by inheritance. The abstraction of the class methods to be implemented by the sub-classes is meant to simplify software development.

A concrete class, however, is a class for which entities (instances) may be created. This contrasts with abstract classes which can not be instantiated because it defeats its purpose of being an 'abstract'.

C++

In C++, an abstract class is a class having at least one pure virtual function. They can not be instantiated and will generate a error if an attempt is made. They were meant to function as sort of stubs, that allow the programmer to identify what modules of functions (behaviour or methods) are needed without bothering to know how to actually implement them.This is inline with OOP of allowing the programmer to concentrate on how an object should behave without going into the actual detail.

Most object oriented programming languages allow the programmer to specify which classes are considered abstract and will not allow these to be instantiated (in Java, for example, the keyword abstract is used). This also enables the programmer to focus on planning and design. The actual implementation of course is to be done in the derived classes.

See, for example, class (object-oriented programming) for a unified discussion.


Example in C++

class Abstract
{
public:
     virtual void MyVirtualMethod() = 0;
};

class Concrete : public Abstract
{
public:
     void MyVirtualMethod()
     {
      //do something
     }
};

An object of class Abstract can not be created because the function MyVirtualMethod has not been defined ( the =0 is C++ syntax for the a pure virtual function, a function that must be part of any (derived) class but is not defined in the base class. The Concrete class is a concrete class because its functions (in this case, only one function) have been declared and implemented.

See also