| point-cpp-cs-exercise/cs/Prog.cs - A C# client class of class Point - with comments that reveal the output. | Lecture 2 - slide 29 : 29 Program 3 |
using System;
public class PointClient{
public static void Main(){
PointClient pc = new PointClient();
pc.Go();
}
public void Go(){
Point p1 = new Point(1, 2),
p2 = new Point(3, 4),
p3 = p1,
p4 = p2,
p5;
p5 = PointMover(p1, p2);
Console.WriteLine("{0} {1} {2} {3} {4}",
p1, // (6,8)
p2, // (-2,-2)
p3, // (6,8) an alias of p1
p4, // (-2,-2) an alias of p2
p5 // (-2,-2) another alias of p2
);
}
public Point PointMover(Point pa, Point pb){
pa.Move(5,6);
pb.Move(-5,-6);
return pb;
}
}