HomeCSharpC# Error CS0713 – Static class ‘{0}’ cannot derive from type ‘{1}’. Static classes must derive from object.

C# Error CS0713 – Static class ‘{0}’ cannot derive from type ‘{1}’. Static classes must derive from object.

C# Error

CS0713 – Static class ‘{0}’ cannot derive from type ‘{1}’. Static classes must derive from object.

Reason for the Error & Solution

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()  
   {  
   }  
}  

Leave a Reply

You May Also Like

This C# program calculates and displays an upper triangular matrix based on user input. Problem Statement: The program takes the...
This C# program serves as a demonstration of bitwise operators, which are fundamental operators used for manipulating individual bits in...
This C# program is designed to interchange or swap the columns of a matrix. A matrix is a two-dimensional array...