In the context of Liskov’s substitution principle does deriving a Square from a rectangle violate the principle? public class Rectangle {public int Height { get; set; } public int Width { get; set; } public int Size { get { return Width * Height; } } } Deriving a Square: public class Square : Rectangle {public int Height { get { return base.Height; } set { base.Height = value; base.Width = value; } } public int Width get { return base.Width; } set { base.Height = value; base.Width = value; } } } For a rectangle we have: Rectangle r = new Rectangle();
| Identifier (URI) | Rank |
|---|---|
| dbkwik:resource/1BldwB_a_Rwc6qPHHKfuZA== | 5.88129e-14 |