Skip to main content

Abstract member cannot be private

In This Article

CodeRush Classic shows the Abstract member cannot be private code issue if an abstract member is marked as private.

#Fix

Change visibility of the abstract member.

#Purpose

Highlights the abstract member declarations, which would cause the Virtual or abstract members cannot be private compilation error.

#Example

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

Fix:

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