Skip to content

Instantly share code, notes, and snippets.

@conanak99

conanak99/rec.cs Secret

Created April 25, 2016 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conanak99/aa750a86f955acf1cb35db8f13f39a1f to your computer and use it in GitHub Desktop.
Save conanak99/aa750a86f955acf1cb35db8f13f39a1f to your computer and use it in GitHub Desktop.
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