I had code:
Program.cs
----------
using System;
class Exercise
{
static void Main(string[] args)
{
People.Person man = new People.Person("Hermine Sandt",
"Male");
1 HighSchool.Teacher staff =
new HighSchool.Teacher("Vice Principal");
Console.WriteLine();
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
}
}
Persons.cs
----------
using System;
namespace People
{
public class Person
{
private string _name;
private string _gdr;
3 public Person()
{
this._name = "Not Available";
this._gdr = "Unknown";
}
public Person(string name, string gender)
{
this._name = name;
this._gdr = gender;
}
}
}
StaffMembers.cs
---------------
using System;
namespace HighSchool
{
public class Teacher : People.Person
{
private string _pos;
public Teacher()
{
this._pos = "Staff Member";
}
2 public Teacher(string pos)
{
this._pos = pos;
}
}
}
When I reach point marked as 1, program calling procedure which I marked as 2. Next step I don't understand. Why is calling constructor (in place marked as 3)? I assumed that happening because class Teacher derivered from People.Person, but I don't understand why it's happening.
Could somebody explain its to me, please?