Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
'function1' : cannot override inherited member 'function2' because it is not marked "virtual", "abstract", or "override"
A method was overridden that was not explicitly marked as virtual, abstract, or override
.
The following sample generates CS0506:
// CS0506.cs
namespace MyNameSpace
{
abstract public class ClassX
{
public int i = 0;
public int f()
{
return 0;
}
// Try the following definition for f() instead:
// abstract public int f();
}
public class ClassY : ClassX
{
public override int f() // CS0506
{
return 0;
}
public static int Main()
{
return 0;
}
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.