Compiler Error CS0713
Static class 'static type' cannot derive from type 'type'. Static classes must derive from object.
If this were allowed, the static class would inherit methods and non-static members from the base class, so it would not be static. Therefore, it is not allowed.
The following sample generates CS0713:
// CS0713.cs
public class Base
{
}
public static class Derived : Base // CS0713
{
}
public class CMain
{
public static void Main()
{
}
}
Inheriting from Static Class should be allowed
A static class should be allowed to derive from another static class. If there are non-static members in the parent class, that would anyway not compile. Further, any static class anyway derives from Object class and that works.
Too restrictive
A static class should be able to inherit from another static class. Inheriting non-static members should throw the same (or similar) error that a non-static member directly in the static class does.
- 6/9/2009
- Foozinator
- 6/13/2009
- Thomas Lee