Virtual Classes Logo          Virtual Classes
    Read Anytime,Anywhere

Abstract class

Abstract classes are typically used to define a base class for the other classes,you can't create an instance of an abstract class.
Abstract classes are declared with the abstract keyword and it can only be used as a super-class for other classes that extend the abstract class.
Abstract class is the concept and implementation gets completed when it is being realized by a subclass. In addition to this a class can inherit only from one abstract class (but a class may implement many interfaces) and and must override all its methods/properties that are declared abstract and may override virtual methods/ properties.
Abstact class can have all/one/many/none abstact methods inside it.

Syntex-
AccessSpecifier AbstarctKeyword ClassKeyword className
{
AccessSpecifier AbstarctKeyword ReturnType MethodName();
//';' after method name defines it's an abstarct method
}

ex-
public abstract class Calculator
{
public abstract int Add(int a, int b);
}
public class Casio:Calculator
{
public override int Add(int a, int b)
{
return a+b;
}
}

If abstract class with all abstract members has the same effect to defining an interface.
A class can inherit one or more interfaces, but only one abstract class.