Edit

Share via


Compiler Error CS0505

'member1': cannot override because 'member2' is not a function

A class declaration attempted to override a non-method in a base class. Overrides must match the member type. If a method with the same name as a method in a base class is desired, use new (and not override) on the method declaration in the base class.

The following sample generates CS0505:

// CS0505.cs  
// compile with: /target:library  
public class clx  
{  
   public int i;  
}  
  
public class cly : clx  
{  
   public override int i() { return 0; }   // CS0505  
}