https://msdn.microsoft.com/en-us/library/ebca9ah3.aspx

The override modifier is required to extend or modify the abstract or virtual implementation of an inherited method, property, indexer, or event.

Example

In this example, the Square class must provide an overridden implementation of Area because Area is inherited from the abstract ShapesClass:

abstract class ShapesClass
{
abstract public int Area();
} class Square : ShapesClass
{
int side = ; public Square(int n)
{
side = n;
} /// <summary>
/// Area method is required to avoid a compile-time error.
/// </summary>
/// <returns></returns>
public override int Area()
{
return side*side;
} internal static void Method()
{
Square sq = new Square();
Console.WriteLine("Area of the square = {0}", sq.Area());
} interface I
{
void M();
} abstract class C : I
{
public abstract void M();
} }

An override method provides a new implementation of a member that is inherited from a base class.

The method that is overridden by an override declaration is known as the overridden base method.

The overridden base method must have the same signature as the override method.

For information about inheritance, see Inheritance (C# Programming Guide).

You cannot override a non-virtual or static method.

The overridden base method must be virtualabstract, or override.

An override declaration cannot change the accessibility of the virtual method.Both the override method and the virtual method must have the same access level modifier.

You cannot use the newstatic, or virtual modifiers to modify an override method.

An overriding property declaration must specify exactly the same access modifier, type, and name as the inherited property, and the overridden property must be virtualabstract, or override.

For more information about how to use the override keyword,

see Versioning with the Override and New Keywords (C# Programming Guide)

andKnowing when to use Override and New Keywords.

override (C# Reference)的更多相关文章

  1. abstract (C# Reference)

    https://msdn.microsoft.com/en-us/library/sf985hc5.aspx The abstract modifier indicates that the thin ...

  2. Spring3 整合Hibernate3.5 动态切换SessionFactory (切换数据库方言)

    一.缘由 上一篇文章Spring3.3 整合 Hibernate3.MyBatis3.2 配置多数据源/动态切换数据源 方法介绍到了怎么样在Sping.MyBatis.Hibernate整合的应用中动 ...

  3. 浅谈开源项目Android-Universal-Image-Loader(Part 3.1)

    本文转载于:http://www.cnblogs.com/osmondy/p/3266023.html 浅谈开源项目Android-Universal-Image-Loader(Part 3.1) 最 ...

  4. 【Java&Android开源库代码剖析】のAndroid-Universal-Image-Loader-part1

    做Android app开发的同学应该都听说过或者用过nostra13的Android-Universal-Image-Loader开源库,它在图片异步加载.缓存和显示等方面提供了强大灵活的框架.之前 ...

  5. Android -- ImageLoader简析

    图片的内存缓存实现 Image-Loader库有一个较完整的内存缓存实现,使用者可以根据需要选择已经实现的策略,也可以定制自己项目中需要的策略. 内存缓存实现代码在memory和memory.impl ...

  6. Java中的软(弱)引用

    一.Java中的强.软.弱.虚引用 在JDK中我们能够看到有一个java.lang.ref的包.这个包中就是Java中实现强.软.弱.虚引用的包,例如以下: PhantomReference 虚引用: ...

  7. ssh,hibernate动态映射多表

    [From] http://www.07net01.com/2016/01/1172051.html 最近在做OA系统(ssh),一直在想如何把框架架得更完善,此前已经在框架里集成springMVC, ...

  8. [原创] 浅谈开源项目Android-Universal-Image-Loader(Part 3.1)

    最近,总算有时间去做些平时喜欢而没空去做的事情.一直觉得项目中使用的Image Loader适用性不强,昨晚在github随便逛逛,发现一个开源项目Android-Universal-Image-Lo ...

  9. JNDI 笔记(一) 概述

    很多地方都会用到JNDI,一大堆的缩写加上一大堆不清不楚的概念描述,使得在看到的时候都不认识,更不要说使用了.   JNDI,Java Naming Directory Interface,J2EE的 ...

随机推荐

  1. jquery中ajax原生代码的分析模仿

    function ajax(obj){     var defaults = {         url: "#",         data: {},         type: ...

  2. KBE实践——登录案例

    目录 服务器 ``` void maini(){ printf("hello world"); } ``` 最小资产库创建 entity配置 实体的Python实现 创建第一个空间 ...

  3. Python 绑定方法与非绑定方法

    用到的: import uuid  --------------  uuid是128位的全局唯一标识符, 通常用32位的一个字符串的形式来表现 uuid.uuid1()  -------------  ...

  4. galera cluster安装与配置

    由于公司数据量与并发的日渐增大,普通的主从复制已无法满足要求.对比了网上PXC.galera.mysql cluster等方案,最终决定选择galera cluster. 以下为安装步骤: 1.下载g ...

  5. node assert.equal()

    浅测试,使用等于比较运算符(==)来比较 actual 和 expected 参数. const assert = require('assert'); assert.equal(1, 1); // ...

  6. 监听服务器 重启apache

    import requests import os import time url = 'http://www.ydyigo.com/findPwd.php' def get_server_statu ...

  7. python爬虫(三)

    Requests模块 这个库的标准文档有个极其幽默的地方就是它的中文翻译,我就截取个开头部分,如下图: 是不是很搞笑,在正文中还有许多,管中窥豹,可见一斑.通过我的使用,感觉Requests库的确是给 ...

  8. python 用 PIL 模块 画验证码

    PIL 简单绘画 def get_code_img(request): from PIL import Image, ImageDraw, ImageFont import random def ra ...

  9. UVa 10129 单词 (欧拉通路)

    题意: 输入n(n≤100000)个单词,是否可以把所有这些单词排成一个序列,使得每个单词的第一个字母和上一个单词的最后一个字母相同(例如acm.malform.mouse).每个单词最 多包含100 ...

  10. ppt_旋转抽奖_制作步骤

    1 ppt制作抽奖转盘 插入饼状图,更改比例,更改颜色(一般选取相邻的一组颜色匹配比较好看): 插入竖文本框,编辑每一个部分为特等奖.一等奖.二等奖.三等奖: 全部选中,ctrl+G组合: 添加陀螺旋 ...