Описание слайда:
class DemoPoint { class DemoPoint { protected int x; protected int y; public void Show() { Console.WriteLine("точка на плоскости: ({0}, {1})", x, y); } public DemoPoint(int x, int y) { this.x = x; this.y = y; } } class DemoShape : DemoPoint { protected int z; new public void Show() { Console.WriteLine("точка в пространстве: ({0}, {1}, {2})", x, y, z); } public DemoShape(int x, int y, int z) : base(x, y) { this.z = z; } } class DemoLine : DemoPoint { protected int x2; protected int y2; new public void Show() { Console.WriteLine("отрезок на плоскости: ({0}, {1})-({2},{3})", x, y, x2, y2); } public DemoLine(int x1, int y1, int x2, int y2) : base(x1, y1) { this.x2 = x2; this.y2 = y2; } } class DemoTriangle : DemoLine { protected int x3; protected int y3; new public void Show() { Console.WriteLine("треугольник на плоскости: ({0}, {1})-({2},{3})-({4},{5})", x, y, x2, y2, x3, y3); } public DemoTriangle(int x1, int y1, int x2, int y2, int x3, int y3) : base(x1, y1, x2, y2) { this.x3 = x3; this.y3 = y3; } } class Program { static void Main() { DemoPoint point = new DemoPoint(1, 1); point.Show(); DemoShape pointShape = new DemoShape(1, 1, 1); pointShape.Show(); DemoLine line = new DemoLine(2, 2, 10, 10); line.Show(); DemoTriangle triangle = new DemoTriangle(0, 0, 0, 3, 4, 0); triangle.Show(); } } }