Facebook
From Funky Wolf, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 86
  1. class Punkt
  2.     {
  3.         private int x, y;
  4.  
  5.         public Punkt(int x, int y)
  6.         {
  7.             this.x = x;
  8.             this.y = y;
  9.         }
  10.  
  11.         public void Wyzeruj()
  12.         {
  13.             this.x = 0;
  14.             this.y = 0;
  15.         }
  16.  
  17.         public void Przesun(int a, int b)
  18.         {
  19.             this.x += a;
  20.             this.y += b;
  21.         }
  22.  
  23.         public override string ToString()
  24.         {
  25.             return "(" + this.x + "," + this.y + ")";
  26.         }
  27.     }
  28.    
  29.    
  30.    
  31.     class Program
  32.     {
  33.         static void Main(string[] args)
  34.         {
  35.  
  36.             Punkt p = new Punkt(4, 9);
  37.  
  38.             Console.WriteLine(p);
  39.  
  40.             p.Wyzeruj();
  41.  
  42.             Console.WriteLine(p);
  43.  
  44.             p.Przesun(7, 24);
  45.  
  46.             Console.WriteLine(p);
  47.  
  48.  
  49.  
  50.         }
  51.     }