예제 #1
0
        static void Main(string[] args)
        {
            Punkt p1 = new Punkt(1, 2);

            p1.Wyswietl();
            PunktKolorowy pc = new PunktKolorowy(2, 3, "zielony");

            pc.Wyswietl();
            Console.WriteLine(pc.Odleglosc(p1));

            PunktKolorowy pc2 = new PunktKolorowy(1, 1, "czarny");

            pc2.Wyswietl();

            Console.WriteLine(pc2.Odleglosc(pc));
        }
예제 #2
0
 public double Odleglosc(Punkt po)
 {
     return(p.Odleglosc(po));
 }
예제 #3
0
 public PunktKolorowy(double x, double y, string kolor)
 {
     this.p     = new Punkt(x, y);
     this.kolor = kolor;
 }
예제 #4
0
 public static bool CzyIdentyczne(Punkt p, Punkt q)
 {
     return(q.CzyIdentyczny(p));
 }
예제 #5
0
 // statyczne, wykorzystujace juz zdefiniowane metody zwykle
 public static double Odleglosc(Punkt p1, Punkt p2)
 {
     return(p1.Odleglosc(p2));
 }
예제 #6
0
 public bool CzyIdentyczny(Punkt p)
 {
     return((x == p.x) && (y == p.y));
 }
예제 #7
0
 // niestatyczne
 public double Odleglosc(Punkt p)
 {
     return(Math.Sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y)));
 }