Pregunta

I read that Liskov's substitution principle is violated if :

  1. Preconditions are strengthened, or

  2. Postconditions are weakened

But I don't get fully yet how these two points would violate Liskov substitution principle. Can some one please explain with an example. Specifically, how would any one of the above conditions cause a situation where a subclass object can not be substituted for a superclass object?

No hay solución correcta

Licenciado bajo: CC-BY-SA con atribución
scroll top