Skip to main content

Abstract member cannot be marked as sealed

In This Article

CodeRush Classic shows the Abstract member cannot be marked as sealed code issue if a member declaration contains both abstract and sealed keywords.

#Fix

Remove the sealed keyword from the member declaration statement.

#Purpose

Highlights the abstract member declarations, which would cause the ‘Member name’ cannot be both abstract and sealed compilation error.

#Example

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

Fix:

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