using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _2_52 { class Program { static void Main(string[] args) { Rectangle rectangle = new Square(12); rectangle.Width = 10; rectangle.Height = 5; Console.WriteLine(rectangle.Area); } } 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; } } } private class Square : Rectangle { public Square(int size):base(size,size) { } public override int Width { get { return base.Width; } set { base.Width = value; base.Width = value; } } } }
private class Square : Rectangle
private
internal
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)