I have one abstract Class and tow implementation for it.
public abstract class Person{
    public abstract string GetName();
} 
public class Doctor : Person{
    public override string GetName()
    {
        return "Doctor";
    }
}
public class Teacher : Person{
    public override string GetName()
    {
        return "teacher";
    }
}
I am using unity to dependency injection.In unity I register Doctor and in run time I need to use teacher ,actually replace that injection in my test2 method : here is my unity injection :
container.RegisterType<Person, Doctor>();
here is my class constructor :
private readonly Iperson _person;
pubice myclass(Iperson person)
{
    _person=person
}
public voide test1()
{
    var Name=_person.GetName();
    // Name is : Doctor
}
public void test2()
{
    //????
    var Name=_person.GetName();
    // Name must be teacher 
}
 
    