68
1
//Learn LSP at https://www.tutorialsteacher.com/csharp/liskov-substitution-principle
2
using System;
3
4
public class Program
5
{
6
public static void Main()
7
{
8
Rectangle sqr1 = new Square();
9
sqr1.Height = 6;
10
sqr1.Width = 8;
11
12
Console.WriteLine(AreaCalculator.CalculateArea(sqr1)); //returns 64
13
14
Rectangle sqr2 = new Square();
15
sqr2.Height = 8;
16
sqr2.Width = 6;
17
18
Console.WriteLine(AreaCalculator.CalculateArea(sqr2)); //returns 36
19
}
20
}
21
22
public class Rectangle
23
{
24
public virtual int Height { get; set; }
Cached Result
ABOUT US
========
We are a group of .NET developers who are sick and tired of starting Visual Studio, creating a new project and running it, just to test simple code or try out samples from other developers.
This tool was inspired by http://jsfiddle.net, which is just awesome.
If you are interested in working on .NET Fiddle please send your resume and links to a couple of your best fiddles to dotnetfiddle at entechsolutions dot com. The most impressive fiddle will get the job.
ENTech Solutions
http://www.entechsolutions.com
========
We are a group of .NET developers who are sick and tired of starting Visual Studio, creating a new project and running it, just to test simple code or try out samples from other developers.
This tool was inspired by http://jsfiddle.net, which is just awesome.
If you are interested in working on .NET Fiddle please send your resume and links to a couple of your best fiddles to dotnetfiddle at entechsolutions dot com. The most impressive fiddle will get the job.
ENTech Solutions
http://www.entechsolutions.com