Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Point
- {
- private int x;
- private int y;
- private string name;
- public int X
- {
- get
- {
- return this.x;
- }
- set
- {
- this.x = value;
- }
- }
- public int Y
- {
- get
- {
- return this.y;
- }
- set
- {
- this.y = value;
- }
- }
- public string Name
- {
- get
- {
- return this.name;
- }
- set
- {
- this.name = value;
- }
- }
- public Point(string name, int x, int y)
- {
- this.X = x;
- this.Y = y;
- this.Name = name;
- }
- public override string ToString()
- {
- return string.Format($"{this.Name}({this.X}, {this.Y})");
- }
- public override bool Equals(object obj)
- {
- Point p = (Point) obj;
- return this.X == p.X && this.Y == p.Y;
- }
- public static bool operator==(Point p1, Point p2)
- {
- return p1.Equals(p2);
- }
- public static bool operator !=(Point p1, Point p2)
- {
- return !p1.Equals(p2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement