-
-
Save conanak99/aa750a86f955acf1cb35db8f13f39a1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Rectangle | |
{ | |
public int Height { get; set; } | |
public int Width { get; set; } | |
public virtual void SetHeight(int height) | |
{ | |
this.Height = height; | |
} | |
public virtual void SetWidth(int width) | |
{ | |
this.Width = width; | |
} | |
public virtual int CalculateArea() | |
{ | |
return this.Height * this.Width; | |
} | |
} | |
public class Square : Rectangle | |
{ | |
public override void SetHeight(int height) | |
{ | |
this.Height = height; | |
this.Width = height; | |
} | |
public override void SetWidth(int width) | |
{ | |
this.Height = width; | |
this.Width = width; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment