About: Nibble 1   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : dbkwik.org associated with source dataset(s)

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();

AttributesValues
rdfs:label
  • Nibble 1
rdfs:comment
  • 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();
dcterms:subject
abstract
  • 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(); r.Height = 10; r.Width = 20; r.Size == 10 * 20; But for a square: Square s = new Square(); s.Height = 10; s.Width = 20; s.Size != 10 * 20;
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software