0% found this document useful (0 votes)
15 views1 page

Constructor in C#

Uploaded by

Madhuri Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Constructor in C#

Uploaded by

Madhuri Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConstructorsInCsharp
{
class Employees
{

int EmpId;
string EmpName;
int EmpAge;

public Employees(int EmpId, string EmpName, int EmpAge)


{
this.EmpId = EmpId;
this.EmpName = EmpName;
this.EmpAge = EmpAge;
}

public int getId()


{
return this.EmpId;
}
public string getName()
{
return this.EmpName;
}
public int getAge()
{
return this.EmpAge;
}
static void Main(string[] args)
{
Employees Ali = new Employees(11,"Ali Khan",22);
Employees Zain = new Employees(12, "Zain Ali", 21);

Console.WriteLine("Employee Id is {0}",Ali.getId());
Console.WriteLine("Employee Name is {0}", Ali.getName());
Console.WriteLine("Employee Age is {0}", Ali.getAge());
Console.WriteLine("--------------------");
Console.WriteLine("Employee Id is {0}", Zain.getId());
Console.WriteLine("Employee Name is {0}", Zain.getName());
Console.WriteLine("Employee Age is {0}", Zain.getAge());
Console.ReadLine();

}
}
}

You might also like