Compiler Error CS0115
'function' : no suitable method found to override
A method was marked as an override, but the compiler found no method to override. For more information, see override, and Knowing When to Use Override and New Keywords.
Example
The following sample generates CS0115. You can resolve CS0115 in one of two ways:
Remove the
override
keyword from the method inMyClass2
.Use
MyClass1
as a base class forMyClass2
.
// CS0115.cs
namespace MyNamespace
{
abstract public class MyClass1
{
public abstract int f();
}
abstract public class MyClass2
{
public override int f() // CS0115
{
return 0;
}
public static void Main()
{
}
}
}
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.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for