This documentation is archived and is not being maintained.

Compiler Error CS0418

'class name': an abstract class cannot be sealed or static

An abstract class cannot be used to create objects unless it is derived from, so it makes no sense to be sealed. An abstract class cannot meaningfully be static either; abstract classes are designed to support an object hierarchy that will use the abstract class as a base.

The following sample generates CS0418:

// CS0418.cs
public abstract sealed class C  // CS0418
{
}

sealed static class S  // CS0418
{
}

public class MyClass
{
    public static void Main()
    {
    }
}
Show: