static void Main(string[] args) { DemoPoint point = new DemoPoint(3, 4); DemoLine line = new DemoLine(point, new DemoPoint(-2, 0)); line.Show(); }
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(); } }
public DemoLine(DemoPoint firstPoint, DemoPoint secondPoint) { this.firstPoint = firstPoint; this.secondPoint = secondPoint; }
public DemoLine() { firstPoint = new DemoPoint(); secondPoint = new DemoPoint(); }
public DemoLine(DemoLine other) { this.firstPoint = other.firstPoint; this.secondPoint = other.secondPoint; }