Let's say that we have 2 classes. The first one is Person
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace People
{
class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
}
The second one is Teacher
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace People
{
class Teacher:Person
{
public string Position { get; set; }
}
}
And I want to make a teacher object using this syntax Person teacher = new Teacher();
When I make it and I try to refer to the Position property, I can't... Why does this happen? I can instead use this syntax Person teacher = new Teacher() {Position="boss" };
but even though, after that I can't refer to the teacher position using "teacher.Position".