using System; namespace inherit { class Program { static void Main(string[] args) { Rectangle a = new Rectangle(); Rectangle b = new Rectangle(2, 3); Brick c = new Brick(); Brick d = new Brick(2, 3, 1); Console.WriteLine("the area of a = {0}", a.area()); Console.WriteLine("the area of b = {0}", b.area()); Console.WriteLine("the area of c = {0}", c.area()); Console.WriteLine("the area of d = {0}", d.area()); Console.WriteLine("the volume of c = {0}", c.volume()); Console.WriteLine("the volume of d = {0}", d.volume()); } } class Rectangle { protected int width; protected int height; public Rectangle() { width = 1; height = 1; } public Rectangle(int side) { this.width = side; this.height = side; } public Rectangle(int width, int height) { this.width = width; this.height = height; } public int area() { return width * height; } } class Brick : Rectangle { protected int thickness; public Brick() { width = 1; height = 1; thickness = 1; } public Brick(int side) { this.width = side; this.height = side; this.thickness = side; } public Brick(int width, int height, int thickness) { this.width = width; this.height = height; this.thickness = thickness; } public int volume() { return width * height * thickness; } } }