首页 > 其他 > 详细

【转载】The Difference Between Virtual and Non-Virtual Methods

时间:2014-03-12 02:28:13      阅读:440      评论:0      收藏:0      [点我收藏+]

In C#, virtual methods support polymorphism, by using a combination of the virtual and override keywords. With the virtual keyword on the base class method and the override keyword on the method in the derived class, both methods are said to be virtual.

Methods that don‘t have either the virtual or override keywords, or that have the new keyword, are said to be non-virtual.

When a virtual method is invoked on an object, the run-time type of the object is used to determine which implementation of the method to use.

When a non-virtual method is invoked on an object, the compile-time type of the object is used to determine which implementation of the method to use.

【转载】The Difference Between Virtual and Non-Virtual Methods,布布扣,bubuko.com

【转载】The Difference Between Virtual and Non-Virtual Methods

原文:http://www.cnblogs.com/yuthreestone/p/3594873.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!