摘要:
4、为什么支持协变的参数只能用于方法的返回值?支持逆变的参数只能用于方法参数?“TParent不能安全转换成TSub”,是这两个问题的共同原因。我们定义一个接口IFoo。interfaceIFoo{voidMethod1(Tparam);TMethod2();}我们看一下协变的过程:IFoo转换成I... 阅读全文
摘要:
// 委托声明 -- 定义一个签名:delegate double MathAction(double num);class DelegateTest{ // 符合委托声明的常规方法 static double Double(double input) { retur... 阅读全文