Please, explain what " : this()" refer to.Cant I use "base" instead of it. When I move cursor on "this" it displays another Constructor . Or when I replace it with "base" it gives this error: "object doesnt contain a constructor that takes 1 argument".
class Employee { private string name; private string surname; private DateTime birthday; private double height; private double salary; public string Name { get { return name; } set { if (name != value) { name = value; } } } public string Surname { get { return surname; } set { if (surname != value) { surname = value; } } } public DateTime Birthday { get { return birthday; } set { if (birthday != value) { birthday = value; } } } public double Height { get { return height; } set { if (height != value) { height = value; } } } public double Salary { get { return salary; } set { if (salary != value) { salary = value; } } } public string Full { get { return name + " " + surname; } } public Employee() { name = "Mina"; surname = "Babayeva"; birthday = DateTime.Now.AddYears(-19); height=175; salary = 3500; } public Employee(string name, string surname, DateTime birthday, double height, double salary) : this( name, surname) { this.birthday = birthday; this.height = height; this.salary = salary; } public Employee(string name) : this() { this.name = name; } public Employee(string name, string surname) : this(name) { this.surname = surname; } public void Print() { Console.WriteLine("Name is {0}\nSurname is {1}\nHeight is {2}\nBirthday is {3}\nSalary is {4}", this.Name, this.Surname, this.Height, this.Birthday.ToString("dd/MM/yyyy"), this.Salary); } //////////////////////////////// Employee a = new Employee(); Employee b = new Employee("Adil", "Babayev"); Employee c = new Employee("Zumrud","Babayeva",DateTime.Now.AddYears(-52),167,1000000); Employee e = new Employee("Hanna"); a.Print(); Console.WriteLine(); b.Print(); Console.WriteLine(); c.Print(); Console.WriteLine(); e.Print(); Console.WriteLine();