A class that you create only to extend from, but not to instantiate from, is an abstract class. This is what definition says for an abstract class.
In the following program Test is an abstract class. And test1 and test2 are instantiations. How can this situation be explained?. Problem is highlighted.
using System;
abstract class Test
{
public int _a;
public abstract void A();
}
class Example1 : Test
{
public override void A()
{
Console.WriteLine("Example1.A");
base._a++;
}
}
class Example2 : Test
{
public override void A()
{
Console.WriteLine("Example2.A");
base._a--;
}
}
class Program
{
static void Main()
{
// Reference Example1 through Test type.
Test test1 = new Example1();
test1.A();
// Reference Example2 through Test type.
Test test2 = new Example2();
test2.A();
Console.Read();
}
}