Cannot create an instance of abstract class

CodeRush Classic shows the Cannot create an instance of abstract class code issue if an instance creation statement references an abstract class.

Fix

Create an instance of a non-abstract descendant of the current abstract class.

Purpose

Highlights the instance creation statements, which would cause the Cannot create an instance of the abstract class or interface compilation error.

Example

abstract class MyClass
{
    public abstract void OutputText(string text);
}
public class TestClass
{
    public TestClass()
    {
        MyClass objVar = new MyClass();
    }
}

Fix:

abstract class MyClass
{
    public abstract void OutputText(string text);
}
class MyClassDescendant: MyClass
{
    public override void OutputText(string text)
    {
        Console.Write(text);
    }
}
public class TestClass
{
    public TestClass()
    {
        MyClass objVar = new MyClassDescendant();
    }
}