本文介绍了ASP.Net中的多态性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我在最近的一次采访中被问到一个问题,在ASP.Net中使用了多少多态? 我从不同的人那里得到了不同的答案, 一个人说ToString()方法,因为它适用于不同的类。 一个人说OnInit()方法System.Web.UI.Page类,因为它被定义为虚拟的,这是多态的关键。 最简洁的定义我可以找到多态: 同样的方法对不同的类有不同的反应。 有什么意见吗? 谢谢提前 Hi, I was asked a question in a recent interview, where in ASP.Net ispolymorphism used? I got differrent answers from different people,One said ToString() method because it is working for different classes.One said OnInit() method of System.Web.UI.Page class because it''s definedvirtual and that''s the key to polymorphism. The most concise definition I can find for polymorphism:Same method reacts differently for different class. Any comments? Thanks in Advance 推荐答案 否,重载不是'' t多态 - 覆盖是多态的。 - Jon Skeet - < sk *** @ pobox.com> http://www.pobox.com/~skeet 如果回复小组,请不要给我发邮件 No, overloading isn''t polymorphism - overriding is polymorphism. --Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeetIf replying to the group, please do not mail me too 这篇关于ASP.Net中的多态性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-27 13:35