TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Implentation Of Properties
Vijayaragavan S
Aug 24
2016
Code
1.4
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
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#