Back to slide -- Keyboard shortcut: 'u'        next -- Keyboard shortcut: 'n'          Point.cs - Class Point in C#.Lecture 4 - slide 2 : 40
Program 1

// This is a C# program.

using System;

public class Point {
  private double x, y;

  public Point(double x, double y){
   this.x = x; this.y = y;
  }

  public double Getx (){
    return x;
  }

  public double Gety (){
    return y;
  }

  public void Move(double dx, double dy){
    x += dx; y += dy;
  }

  public double DistanceTo(Point p){
    return Math.Sqrt((x - p.x) * (x - p.x) + (y - p.y) * (y - p.y));
  }

  public override string ToString(){
    return "Point: " + "(" + x + ", " + y + ")" + ". ";
  }
}