Qtr No. 213, New Town Yehlanka
Indore 454775, India
What will be the value of the salary after the below given code is executed?
public class Employee
{
private int salary;
public int Salary
{
private get
{
return salary;
}
set
{
salary = value;
}
}
public Employee(int salary)
{
this.Salary = salary;
}
}
class Program
{
static void Main(string[] args)
{
Employee objCC = new Employee(10000);
objCC.Salary++;
}
}
10000
10001
Compilation Error:The property cannot be used in this context because the get accessor is inaccessible
10002
To get all Basic CSharp Programming Assessment Exam questions Join Telegram Group https://rebrand.ly/lex-telegram-236dee