Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Practice
- {
- public class Employee
- {
- private string name;
- private string date;
- private decimal salary;
- public string Name
- {
- get
- {
- return name;
- }
- }
- public string Date
- {
- get
- {
- return date;
- }
- }
- public decimal Salary
- {
- get
- {
- return salary;
- }
- set
- {
- salary = value;
- }
- }
- public Employee(string theName, string theDate, decimal theSalary)
- {
- name = theName;
- date = theDate;
- Salary = theSalary;
- }
- }
- public class EmployeeTest1
- {
- public static void Main()
- {
- Employee emp1 = new Employee("John", "12/05/18", 2500);
- Console.WriteLine("Name is {0} ", emp1.Name);
- Console.WriteLine("Date is {0}", emp1.Date);
- Console.WriteLine("Salary is {0}", emp1.Salary);
- emp1.Salary = 2750;
- Console.WriteLine("New Salary is {0}", emp1.Salary);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement