using System;
class point {
int getx, gety;
//Property definition
public int x {
get {
return getx;
} //get property
set {
getx = value;
} // set property
}
public int y {
get {
return gety;
}
set {
gety = value;
}
}
}
class Program {
static void Main(string[] args) {
point start = new point();
point end = new point();
//Property Usage
start.x = 10;
start.y = 20;
end.x = 100;
end.y = 200;
Console.Write("\npoint 1 :" + start.x + " " + end.x);
Console.Write("\npoint 2 :" + start.y + " " + end.y);
Console.ReadKey();
}
}This code is an implementation of properties, ie, How to create a properties and its Usage in a class.
