为什么泛型不支持协变性?
摘要:假设class S { }class A : S { }class B : S { }下面的代码是可以编译通过的S[] array = new A[5];array[0] = new B();List list = new List();运行结果:第一行代码是可以编译通过的第二行代码运行时报错第三行...
阅读全文
posted @ 2014-06-29 23:38
posted @ 2014-06-29 23:38
posted @ 2014-06-29 23:21