object oriented – Does adding a method to a sub-class with the same name of the parent class method, break substitutability principle?


Let T be a superclass, and S derives from it:

abstract class T{
public virtual byte() Foo(string str){...}
}

class S : T{
public override byte() Foo(string str){....}
public byte() Foo(string str, bool b){...}
}

As per the LSP, if:

S s = new S();
var data = s.Foo("dt", false);

I should be able to substitute S with T:

T t = new S();

var data = t.Foo("dt", false); //can't call this.

Does this design break LSP?

Should I, in this case, change the name of the method in the derived class?