Is a square a rectangle? Liskov substitution principle in action #141
Replies: 1 comment 1 reply
-
|
Thank you for writing this example up. It looks good. However, on the Rectangle's Width and Height auto-implemented properties, I noticed you have the private access modifier on the set accessors. This won't work. They both should be protected. Otherwise, the derived class can't access them. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is a square a rectangle? Liskov substitution principle in action
I will put that simple question in the room: "Is a square a rectangle?" And you might thank: "Well dah, of course!"
But wait for a second and let's check it together. We will use the L in SOLID: The Liskov Substitution principle to check if this relationship makes sense for us!
https://steven-giesel.com/blogPost/67425427-01cd-4707-8572-991c3f9c5fc2
Beta Was this translation helpful? Give feedback.
All reactions