<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://jholjhapata.com/index.php?action=history&amp;feed=atom&amp;title=Liskov_Substitution_Principle</id>
	<title>Liskov Substitution Principle - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://jholjhapata.com/index.php?action=history&amp;feed=atom&amp;title=Liskov_Substitution_Principle"/>
	<link rel="alternate" type="text/html" href="https://jholjhapata.com/index.php?title=Liskov_Substitution_Principle&amp;action=history"/>
	<updated>2026-08-18T03:05:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.0</generator>
	<entry>
		<id>https://jholjhapata.com/index.php?title=Liskov_Substitution_Principle&amp;diff=35&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;The '''Liskov substitution principle''' states that if S is a subtype of T, then objects of type T may be replaced (or substituted) with objects of type S.  In other words a s...&quot;</title>
		<link rel="alternate" type="text/html" href="https://jholjhapata.com/index.php?title=Liskov_Substitution_Principle&amp;diff=35&amp;oldid=prev"/>
		<updated>2019-08-15T14:58:21Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;The &amp;#039;&amp;#039;&amp;#039;Liskov substitution principle&amp;#039;&amp;#039;&amp;#039; states that if S is a subtype of T, then objects of type T may be replaced (or substituted) with objects of type S.  In other words a s...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The '''Liskov substitution principle''' states that if S is a subtype of T, then objects of type T may be replaced (or substituted) with objects of type S.&lt;br /&gt;
&lt;br /&gt;
In other words a subclass should override the parent class methods in a way that does not break functionality.&lt;br /&gt;
== Liskov Substitution Principle Example ==&lt;br /&gt;
&lt;br /&gt;
In the below code we can notice that reference of '''Shapes''' can hold object of '''Square''' and '''Circle''' because it is inherited from Shapes. &lt;br /&gt;
&lt;br /&gt;
    class Program&lt;br /&gt;
    {&lt;br /&gt;
        static void Main(string[] args)&lt;br /&gt;
        {&lt;br /&gt;
            Shapes _Shapes = new Square() { length=4, width=5};&lt;br /&gt;
            _Shapes.calculateArea();&lt;br /&gt;
            _Shapes = new Circle() { radius = 4 };&lt;br /&gt;
            _Shapes.calculateArea();&lt;br /&gt;
            Console.ReadLine();&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    abstract class Shapes&lt;br /&gt;
    {&lt;br /&gt;
        public Shapes()&lt;br /&gt;
        {&lt;br /&gt;
            Console.WriteLine(&amp;quot;Class : Shapes&amp;quot;);&lt;br /&gt;
        }&lt;br /&gt;
        public abstract double calculateArea();&lt;br /&gt;
    }&lt;br /&gt;
    class Square : Shapes&lt;br /&gt;
    {&lt;br /&gt;
        public double length { get; set; }&lt;br /&gt;
        public double width { get; set; }&lt;br /&gt;
        public override double calculateArea()&lt;br /&gt;
        {&lt;br /&gt;
            return (length * width);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    class Circle : Shapes&lt;br /&gt;
    {&lt;br /&gt;
        public double radius { get; set; }&lt;br /&gt;
        public override double calculateArea()&lt;br /&gt;
        {&lt;br /&gt;
            return ((3.14) * radius * radius);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
		
	</entry>
</feed>