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.

原文地址:#349 - The Difference Between Virtual and Non-Virtual Methods

【转载】#349 - The Difference Between Virtual and Non-Virtual Methods的更多相关文章

  1. ASP.NET :Virtual Application vs Virtual Directory

    原文地址:http://blogs.msdn.com/b/wenlong/archive/2006/11/22/virtual-application-vs-virtual-directory.asp ...

  2. c++ virtual 和 pure virtual的区别

    参考资料: http://stackoverflow.com/questions/1306778/c-virtual-pure-virtual-explained 验证代码: #include < ...

  3. 析构函数virtual与非virtual区别 [转]

    作为通常的原则,如果一个类定义了虚函数,那么它的析构函数就应当是virtual的.因为定义了虚函数则隐含着:这个类会被继承,并且会通过基类的指针指向子类对象,从而得到多态性.   这个类可能会被继承, ...

  4. pure virtual、impure virtual、non-virtual函数的接口继承和实现继承

    1.abstract class 拥有pure virtual函数的class是abstract class. 不能创建abstract class的实体. 2.pure virtual 函数 他们必 ...

  5. [New Portal]Windows Azure Virtual Machine (17) Virtual Machine成本分析

    <Windows Azure Platform 系列文章目录> 在Windows Azure VM里,计费模式是和以下几个因素有关: 成本1: VM Type and VM Size 具体 ...

  6. What is the difference between concurrency, parallelism and asynchronous methods?

    Ref: http://stackoverflow.com/questions/4844637/what-is-the-difference-between-concurrency-paralleli ...

  7. Genymotion模拟器无法开启的解决方法——Unable to start the virtual device,The virtual device got no IP address

    前言 最近重装了电脑的系统,由win7换成了win8.1.android开发环境也重新配置了一遍.其他的都还好,就是genymotion模拟器一直开启失败. 自己尝试了很多方法,比如卸载重装软件,重新 ...

  8. C#中Abstract和Virtual[转载]

    原文:http://www.cnblogs.com/blsong/archive/2010/08/12/1798064.html 在C#的学习中,容易混淆virtual方法和abstract方法的使用 ...

  9. C#中Abstract和Virtual(转载)

    在C#的学习中,容易混淆virtual方法和abstract方法的使用,现在来讨论一下二者的区别.二者都牵涉到在派生类中与override的配合使用. 一.Virtual方法(虚方法) virtual ...

随机推荐

  1. Go语言基础之12--Channel

    一.不同goroutine之间如何进行通讯? 1.全局变量和锁同步 缺点:多个goroutine要通信时,定义太多的全局变量(每个全局变量功能不一样),不好维护 2.Channel 二.channel ...

  2. bean copy

    最初采用apache beanutils,性能很低.后来转为hutool,但不能复制指定格式的日期,所以采用性能很高的com.github.yangtu222.BeanUtils 它已经实现了 cop ...

  3. java——第十二章 异常处理和文本I/O

    1.异常处理: 使用try_throw_catch块模块 优点:将检测错误(由被调用的方法完成)从处理错误(由调用方法完成)中分离出来. 例子: package test; import java.u ...

  4. Vue 中怎么发起请求(一)

    1.vue 支持开发者引入 jquery 使用 $.ajax() 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1.首先,在 package.json 中添加 j ...

  5. my22_mydumper 使用总结

    1. mydumper 的安装依赖于mysql软件,要使用mydumper 则服务器上必须先安装mysql 2. mydumper 安装时会使用mysql软件的动态链接库文件,如果服务器上mysql版 ...

  6. Window 远程连接 Ubuntu 系统

    安装XRDP 服务, 用windows远程连接ubuntu 1. Step 1 – Install xRDP sudo apt-get update sudo apt-get install xrdp ...

  7. 移动测试之appium+python 环境安装(一)

    准备工作 一.Python安装 下载地址 及环境变量配置 注意:安装时候记得勾选上Add python.exe to Path.这可以省略环境变量配置. 如果没有勾选,安装下边操作 找到path环境变 ...

  8. jdk源码分析——java.lang.Boolean

      1.Boolean类里面的2个静态变量. Boolean类,直接声明了2个静态变量,TRUE 和 FALSE,指向2个对象.     public static final Boolean TRU ...

  9. IOS Intro - NSDictionary and NSMutableDictionary

    NSDictionary.NSMutableDictionary的基本用法 1.不可变词典NSDictionary 字典初始化 NSNumber *numObj = [NSNumber numberW ...

  10. SUN巡检命令

    # hostname (主机名)# hostid# uname -X# uname -a # w (进程)# who# last# ps -eaf# /usr/ucb/ps -aux# prstat ...