I'm trying to implement an interface inheritance system in my C# project, but I can't get it to work.
Here is a simplified version:
public interface BaseInterface {}
public abstract class AbstractClass<T> where T : BaseInterface {}
public interface ChildInterface : BaseInterface {}
public class ConcreteClass : AbstractClass<ChildInterface> {}
I want to use it as follow:
AbstractClass<BaseInterface> c = new ConcreteClass();
The last line of code gives me the following error:
Cannot implicitly convert type 'ConcreteClass' to 'AbstractClass<BaseInterface>'
Why is the conversion impossible?