Say I have:
interface Thing
{
GetThing();
}
class FastThing : Thing
{
public int GetThing()
{
return 1;
}
}
class SlowThing : Thing
{
public int GetThing()
{
return GetThingFromDatabase();
}
}
Is this a violation of the Liskov Substitution Principle?
GetThingFromDatabase()is not slow enough to make this controversial.Factor4096BitPublicKey();return 1;would make things a bit more interesting. – Patrick Feb 10 '13 at 09:46FastThingwithSlowThing, the LSP does not apply. If you add a comment toThing::GetThingwhich says "Is very fast", the question can be discussed. – Cephalopod Nov 10 '13 at 20:08