Advertisement
pangheemeng

ReferenceType2

Feb 12th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ReferenceType2
  8. {
  9.     class Point
  10.     {
  11.           public int X { get; set; }
  12.           public int Y { get; set; }
  13.     }
  14.     static void Main(string[] args)
  15.     {
  16.          Point p1 = new Point();
  17.          p1.X = 10;
  18.          p1.Y = 5;
  19.  
  20.          ChangePoint(p1);
  21.  
  22.          Console.WriteLine("X: {0}, Y:{1}", p1.X, p1.Y);
  23.     }
  24.      static void ChangePoint(Point p)
  25.     {
  26.          p.X = 20;
  27.          p.Y = 10;
  28.     }
  29. }
  30.     // LECTURE 39 Reference Type Illustrated - 2
  31.     // CS0116 LINE 14 & 24
  32.     // CS0103 LINE 20
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement