Erro do Compilador CS0506Compiler Error CS0506
' function1 ': não é possível substituir o membro herdado ' function2 ' porque não está marcado como "virtual", "Abstract" ou "override"'function1' : cannot override inherited member 'function2' because it is not marked "virtual", "abstract", or "override"
Um método foi substituído e não foi explicitamente marcado como virtual, abstractou override
.A method was overridden that was not explicitly marked as virtual, abstract, or override
.
O exemplo a seguir gera CS0506: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;
}
}
}