-
Consider this code: public class C {
public virtual bool M(string? input) {
return true;
}
}
public abstract class D : C {
public override bool M(string? input) {
return base.M(input);
}
public abstract bool M(ReadOnlySpan<char> input);
}
public static class Test {
public static void Run(D d) {
var teststring = "Blah";
d.M(teststring);
}
} Question: why in the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
What is happening here is that |
Beta Was this translation helpful? Give feedback.
What is happening here is that
D.M(ReadOnlySpan<char>)
is chosen overC.M(string?)
, because methods from derived classes are considered before methods from base classes. And, for the purposes of overload resolution,D.M(string?)
does not exist.