Information Technology Reference
In-Depth Information
Abstract Classes
An abstract class can be used only as the base class of another class. Abstract classes are
designed to be inherited from.
￿
You cannot define variables or create instances of an abstract class.
An abstract class is declared by using the abstract modifier.
￿
Keyword
abstract class MyClass
{
...
}
￿
An abstract class can contain abstract members, but that is not a requirement. The
members of an abstract class can be any combination of abstract members and
normal members with implementations.
￿
An abstract class can, itself, be derived from another abstract class. For example, the fol-
lowing code shows one abstract class derived from another.
abstract class AbClass // Abstract class
{
...
}
abstract class MyAbClass : AbClass // Abstract class derived from
{ // an abstract class
...
}
￿
Any class derived from an abstract class must implement all the abstract members of the
class by using the override keyword, unless the derived class is, itself, abstract .
Search WWH ::




Custom Search