The requested page is not available for the requested platform. You are viewing the content for Default platform.

Abstract member cannot be declared in nonabstract class

CodeRush Classic shows the Abstract member cannot be declared in nonabstract class code issue if a non-abstract class contains an abstract member.

Fix

Add the abstract keyword to the class declaration statement.

Purpose

Highlights the abstract member declarations, which would cause the 'Member name' is abstract but it is contained in non-abstract class compilation error.

Example

public class MyShape
{
    public abstract double GetArea();
}

Fix:

public abstract class MyShape
{
    public abstract double GetArea();
}