- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
面向对象_5多重继承的
* * * * * * * * * * * * * * * * * * * * Set Set out 开始 Set off 出发 Set down 记下 * * * * * * * * * * * * * * * * * class Parent{ public virtual void aMethod(int){ … } } class Child : Parent{ public new virtual void aMethod(int){ … } } C#方案 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 如果两个或更多的方法具有相同的名称和相同的参数数目,编译器如何匹配? P223继承层次的例子 Java例 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. * * Dessert Pie Cake ApplePie ChocolateCake Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. * * Void order (Dessert d, Cake c); Void order (Pie p, Dessert d); Void order (ApplePie a, Cake c); order (aDessert, aCake);//执行方法一 order (anApplePie , aDessert);//执行方法二 order (aDessert , aDessert);//错误 order (anApplePie , aChocolateCake);//执行方法三 order (aPie , aCake);//错误 order (aChocolateCake, anApplePie ); order (aChocolateCake, aChocolateCake); order (aPie , aChocolateCake); Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. Object o=new object(); Automobile auto=new automobile(); Object autoObject=new Automobile() auto.equals(o); auto.equals(auto); auto.equals(autoObject); o.equals(o); o.equals(auto); o.equals(autoObject); autoObject.equals(o); autoObject.equals(auto); autoObject.equals(autoObject); * * +equals(o:Object):boolean +equals(o:Automobile):boolean +equals(o:Object):boolean Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. * * 当子类定义了一个与父类具有相同名称但类型签名不同的方法时,发生重定义。 类型签名的变化是重定义区别于改写的主要依据。 两种不同的技术解析重定义:融和模型和分级模型。 重定义 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. * * JAVA使用融和模型 class Parent { public void ex
原创力文档


文档评论(0)