Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace Task1
- {
- public interface IDraw
- {
- void Draw();
- }
- public class DrawRectangle : IDraw
- {
- public void Draw()
- {
- Console.WriteLine("Это прямоугольник");
- }
- }
- public class DrawRing : IDraw
- {
- public void Draw()
- {
- Console.WriteLine("Это кольцо");
- }
- }
- public abstract class Figure
- {
- public abstract int X { get; set; }
- public abstract int Y { get; set; }
- public abstract string GetName();
- public abstract void Draw();
- }
- public class Ring : Figure
- {
- private IDraw IDraw { get; set; }
- public override int X { get; set; }
- public override int Y { get; set; }
- public uint Radius { get; set; }
- public Ring(int X,int Y,uint Radius,IDraw Draw)
- {
- this.X = X;
- this.Y = Y;
- this.Radius = Radius;
- IDraw = Draw;
- }
- public override void Draw()
- {
- IDraw.Draw();
- }
- public override string GetName()
- {
- return "Ring";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement