Created
September 15, 2020 08:17
-
-
Save dan0nchik/e3c2fb0568603ebbbbef53ebc216ae7f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Runtime.CompilerServices; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace Многоугольники | |
{ | |
public partial class Form1 : Form | |
{ | |
Graphics k; | |
public Form1() | |
{ | |
InitializeComponent(); | |
Shape[] array = {new Circle(2,3), new Triangle(2,5), new Square(0,0) }; | |
foreach (Shape i in array) i.Draw(k); | |
} | |
} | |
public abstract class Shape | |
{ | |
private int x, y; | |
static int R; | |
static Color lineC, fillC; | |
public Shape(int xx, int yy) | |
{ | |
x = xx; | |
y = yy; | |
} | |
static Shape() | |
{ | |
R = 0; | |
} | |
public virtual void Draw(Graphics g) | |
{ | |
} | |
public bool IsInside(int xx, int yy) | |
{ | |
return true; | |
} | |
} | |
public class Circle : Shape | |
{ | |
public Circle(int xx, int yy) : base(xx,yy) | |
{ | |
} | |
public override void Draw(Graphics g) | |
{ | |
} | |
} | |
public class Triangle : Shape | |
{ | |
public Triangle(int xx, int yy) : base(xx, yy) | |
{ | |
} | |
public override void Draw(Graphics g) | |
{ | |
} | |
} | |
public class Square : Shape | |
{ | |
public Square(int xx, int yy) : base(xx, yy) | |
{ | |
} | |
public override void Draw(Graphics g) | |
{ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment