Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Implentation Of Properties
WhatsApp
Vijayaragavan S
Aug 24
2016
1.4
k
0
0
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();
}
}
Properties
C#
Up Next
Implentation Of Properties