I have this bit of code and it will demonstrate Liskov substitution, but I'm confused about what the base keyword does with two arguments. Can someone explain?
class Rectangle
{
public Rectangle(int width, int height)
{
Width = width;
Height = height;
}
public virtual int Height {get;set;}
public virtual int Width {get;set;}
public int Area
{
get { return Height*Width }
}
And now for a square class that inherits a base class with two arguments. I was also curious why this next Square (int) method could use the method in a base class with a different name
private class Square : Rectangle
{
public Square(int size) : base(size, size) {}
public override int Width
{
get {return base.Width}
set { base.Width = value; base.Height = value}
}
public override int Height
{
}
source
share