This is a question about the fundamental object oriented concept called polymorphism. A Teacher
is a Person
, but your list of Person
instances only knows that it contains a list of Person
instances; it doesn't know anything about classes that derive from Person
, nor does it need to.
If you are working with elements in your list, you can determine their type, and then cast them into that type like so:
foreach (Person x in people)
{
if (x is Teacher)
{
Teacher y = (Teacher) x;
}
}
Then you can access the properties of teacher: y.Position
.