Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • You did not demonstrate "replacing" any object. "Replacing" a superclass object with a subclass object means actually changing the source code. In order to demonstrate the LSP, you should show two versions of your code, before and after the replacement. Commented Sep 10, 2020 at 5:08
  • Okay so if I understand correctly, LSP isn't about "casts"? It's about the actual replacement of the instance of the superclass with one of the subclasses' instances and still be valid, right? Commented Sep 10, 2020 at 5:19
  • 1
    Correct. It's not about casts. Commented Sep 10, 2020 at 5:21