I have clases and interface like this:
public interface IPerson
{
public string Name { get; set; }
}
public class Person : IPerson
{
public string Name { get; set }
public int Age { get; set; }
}
public interface IMove<T>
{
void ChangeLocation(T obj);
}
public class Move<T> : IMove<T>
{
public void ChangeLocation(T obj)
{
throw new NotImplementedException();
}
}
And I can do stuff like this:
IPerson p = new Person();
IMove<Person> t1 = new Move<Person>();
IMove<IPerson> t2 = new Move<IPerson>();
But when I'm trying to do:
IMove<IPerson> t3 = new Move<Person>();
compiler is showing error:
Cannot implicity convert type Move<Person> to IMove<IPerson>
Can you please explain why so?