Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> if all it did was substitute for X, and behave exactly the same way?

LSP is about behaviour existing in the supertype. Adding behaviour doesn't violate LSP.

> In a graphics program, an ellipse and rectangle are substitutable in that they have a draw() method and others, so that they plug into the framework.

The behaviour in question means it draws something. It can draw something different every time, and not violate LSP here.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: