Skip to content

Instantly share code, notes, and snippets.

@dan0nchik
Created September 15, 2020 08:17
Show Gist options
  • Save dan0nchik/e3c2fb0568603ebbbbef53ebc216ae7f to your computer and use it in GitHub Desktop.
Save dan0nchik/e3c2fb0568603ebbbbef53ebc216ae7f to your computer and use it in GitHub Desktop.
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