Skip to main content

Abstract member cannot declare a body

In This Article

CodeRush Classic shows the Abstract member cannot declare a body code issue if an abstract member has a body.

#Fix

Remove the body of the abstract member or remove the abstract modifier.

#Purpose

Highlights the abstract member declarations, which would cause the ‘Member name’ cannot declare a body because it is marked abstract compilation error.

#Example

public abstract double GetArea()
{
    return Width*Height;
}

Fix:

public abstract double GetArea();

or

public double GetArea()
{
    return Width*Height;
}