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
Constructor Chaining With Example In C#
Soumalya Das
Aug 23
2016
Code
1.1
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
namespace
Consolepractice {
class
Program {
public
static
void
Main(
string
[] args) {
student on =
new
student(
"Soumalya"
,
"132"
,
"M"
,
"7278283469"
);
Console.ReadKey();
}
}
class
student {
private
string
_name;
private
string
_roll;
private
string
_gender;
private
string
_phn;
public
student() {
Console.WriteLine(
"default"
);
}
public
student(
string
Name):
this
() {
this
._name = Name;
}
public
student(
string
Name,
string
Roll):
this
(Name) {
this
._roll = Roll;
}
public
student(
string
Name,
string
Roll,
string
Gender):
this
(Name, Roll) {
this
._gender = Gender;
}
public
student(
string
Name,
string
Roll,
string
Gender,
string
Phn):
this
(Name, Roll, Gender) {
this
._phn = Phn;
}
}
}
Constructor Chaining
C#