using System using System Collections Generic using System Linq using

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace my
{
class Program
{
class Point: Shape
{
public Point(int x, int y)
: base(x, y)
{ }
public override void draw()
{
Console.WriteLine("Risovat v {0} {1}", x, y);
}
}
class reqtangle: Shape
{
public reqtangle(int x, int y, int w, int h):base(x,y)
{
}
public override void draw()
{
Console.WriteLine("Risovat v pryamougolnik v x={0} y={1} ", x, y);
}
}
class Shape
{
protected int x;
protected int y;
public Shape(int a, int b)
{
this.x = a;
this.y = b;
}
public virtual void draw()
{ }
}
class myclass
{
int x;
public myclass(int a)
{
this.x = a;
}
public int metod(myclass qwe)
{
return qwe.x+x;
}
}
struct myClass2
{
int a = 2;
int b = 3;
}
static void Main(string[] args)
{
Point a = new Point(1, 2);
a.draw();
reqtangle qwe = new reqtangle(1, 2, 3, 4);
qwe.draw();
Shape[] sh = new Shape[4];
sh[0] = new Point(3, 5);
sh[1] = new reqtangle(3, 4, 5, 6);
sh[2] = new Point(1, 2);
sh[3] = new reqtangle(1, 4, 2, 6);
foreach (Shape s in sh)
s.draw();
myclass rty = new myclass(2);
myclass rty1 = new myclass(3);
Console.WriteLine(rty.metod(rty1));
}
}
}