static void Main(string[] args) { var circle = new Circle(); I2DShape circle2d = circle; I3DShape circle3d = circle; circle2d.Draw(); circle3d.Draw(); }
public static I2DShape GreaterArea(I2DShape shape1, I2DShape shape2) { if (shape1.Area > shape2.Area) { Console.WriteLine($"{shape1.Name}'s area: {shape1.Area} is greater than {shape2.Name}'s area: {shape2.Area}."); return(shape1); } else { Console.WriteLine($"{shape2.Name}'s area: {shape2.Area} is greater than {shape1.Name}'s area: {shape1.Area}."); return(shape2); } }
public void AddShape(I2DShape shape) { Shapes.Add(shape); }
public static void PrintInfo(I2DShape shape) { Console.WriteLine($"Name: {shape.Name}"); Console.WriteLine($"Area: {shape.Area}"); Console.WriteLine($"Perimeter: {shape.Parimeter}"); }