Advertisement
zsoltizbekk

2016.02.23_c#...

Feb 23rd, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.90 KB | None | 0 0
  1. //main
  2.  
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using geom;
  9.  
  10. namespace ConsoleApplication1
  11. {
  12.     class Program
  13.     {
  14.         static void Main(string[] args)
  15.         {
  16.             Console.WriteLine("hello");
  17.             Pont p1 = new Pont(4, 5, "fekete");
  18.             //Console.WriteLine("({0}, {1})", p1.x, p1.y);
  19.             //###
  20.             //Console.WriteLine("({0}, {1})", p1.getX(), p1.getY());
  21.             //p1.setX(-3);
  22.             //Console.WriteLine("({0}, {1})", p1.getX(), p1.getY());
  23.  
  24.             Console.WriteLine("({0}, {1}), {2}", p1.X, p1.Y, p1.Szin);
  25.             p1.X = -3;
  26.             Console.WriteLine("({0}, {1}), {2}", p1.X, p1.Y, p1.Szin);
  27.         }
  28.     }
  29. }
  30.  
  31. ##############
  32.  
  33. //pont.cs
  34.  
  35. using System;
  36. using System.Collections.Generic;
  37. using System.Linq;
  38. using System.Text;
  39. using System.Threading.Tasks;
  40.  
  41. namespace geom
  42. {
  43.     class Pont
  44.     {
  45.         private int x, y;
  46.         public int X
  47.         {
  48.             get
  49.             {
  50.                 return x;
  51.             }
  52.             set
  53.             {
  54.                 x = value;
  55.             }
  56.         }
  57.  
  58.         public int Y
  59.         {
  60.             get
  61.             {
  62.                 return y;
  63.             }
  64.             set
  65.             {
  66.                 y = value;
  67.             }
  68.         }
  69.         public string Szin { get; private set; }
  70.  
  71.         public Pont (int x, int y, string szin)
  72.         {
  73.             this.x = x;
  74.             this.y = y;
  75.             Szin = szin;
  76.         }
  77.         //public int getX()
  78.         //{
  79.         //    return x;
  80.         //}
  81.  
  82.         //public int getY()
  83.         //{
  84.         //    return y;
  85.         //}
  86.  
  87.         //public void setX(int x)
  88.         //{
  89.         //    this.x = x;
  90.         //}
  91.         //public void setY(int y)
  92.         //{
  93.         //    this.y = y;
  94.         //}
  95.  
  96.     }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement