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
User Defined Constructor Code in C#
Sandeep Kumar
Mar 22
2015
Code
1.7
k
0
2
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
namespace
CAConstructor
{
class
Employeee
{
int
EmpId, EAge;
string
EName, EAddress;
public
class
Employee()
{
this
.EmpId = 101;
this
.EName =
"Sandeep"
;
this
.EAge = 26;
this
.EAddress =
"Hyderabad"
;
}
public
void
DispEmpData()
{
Console.WriteLine(
"Employee Id Is:"
+
this
.EmpId);
Console.WriteLine(
"Employee Name Is:"
+
this
.EName);
Console.WriteLine(
"Employee Address is:"
+
this
.EAddress);
Console.WriteLine(
"Employee Age Is:"
+
this
.EAge);
}
class
EmployeeDetail
{
static
void
Main(
string
[] args)
{
Employee Emp1 =
new
Employee();
Employee Emp2 =
new
Employee();
Emp1.DispEmpData();
Emp2.DispEmpData();
}
}
}
}
User Defined Constructor Code