Пример #1
0
        static void Main(string[] args)
        {
            DemoPoint point = new DemoPoint(3, 4);
            DemoLine  line  = new DemoLine(point, new DemoPoint(-2, 0));

            line.Show();
        }
Пример #2
0
 public static void Main(string[] args)
 {
     IDemo[] a = new IDemo[4];
     // заповнення масиву
     a[0] = new DemoPoint(0, 1);
     a[1] = new DemoPoint(-3, 0);
     a[2] = new DemoShape(3, 4, 0);
     a[3] = new DemoShape(0, 5, 6);
     // перегляд масиву
     foreach (IDemo x in a)
     {
         x.Show();
         Console.WriteLine("Length = {0:f2}", x.Length());
         Console.WriteLine("x = " + x.X);
         x[1] += x[0];
         Console.Write("new cordinates - ");
         x.Show();
         Console.WriteLine();
     }
 }
Пример #3
0
 public DemoLine(DemoPoint firstPoint, DemoPoint secondPoint)
 {
     this.firstPoint  = firstPoint;
     this.secondPoint = secondPoint;
 }
Пример #4
0
 public DemoLine()
 {
     firstPoint  = new DemoPoint();
     secondPoint = new DemoPoint();
 }
Пример #5
0
 public DemoLine(DemoLine other)
 {
     this.firstPoint  = other.firstPoint;
     this.secondPoint = other.secondPoint;
 }