Given the following code:
namespace sample
{
class a { }
class b : a { }
public class wrapper<T> { }
class test
{
void test1()
{
wrapper<a> y = new wrapper<b>();
//Error 11 Cannot implicitly convert type 'sample.wrapper<sample.b>' to 'sample.wrapper<sample.a>'
}
}
}
Logically speaking, a since b is a, a wrapper<b> is a wrapper<a>. Then why I can't make this conversion, or how can I make it?
Thanks.