override (C# Reference)
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 virtual, abstract, 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 new, static, 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 virtual, abstract, 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)的更多相关文章
- abstract (C# Reference)
https://msdn.microsoft.com/en-us/library/sf985hc5.aspx The abstract modifier indicates that the thin ...
- Spring3 整合Hibernate3.5 动态切换SessionFactory (切换数据库方言)
一.缘由 上一篇文章Spring3.3 整合 Hibernate3.MyBatis3.2 配置多数据源/动态切换数据源 方法介绍到了怎么样在Sping.MyBatis.Hibernate整合的应用中动 ...
- 浅谈开源项目Android-Universal-Image-Loader(Part 3.1)
本文转载于:http://www.cnblogs.com/osmondy/p/3266023.html 浅谈开源项目Android-Universal-Image-Loader(Part 3.1) 最 ...
- 【Java&Android开源库代码剖析】のAndroid-Universal-Image-Loader-part1
做Android app开发的同学应该都听说过或者用过nostra13的Android-Universal-Image-Loader开源库,它在图片异步加载.缓存和显示等方面提供了强大灵活的框架.之前 ...
- Android -- ImageLoader简析
图片的内存缓存实现 Image-Loader库有一个较完整的内存缓存实现,使用者可以根据需要选择已经实现的策略,也可以定制自己项目中需要的策略. 内存缓存实现代码在memory和memory.impl ...
- Java中的软(弱)引用
一.Java中的强.软.弱.虚引用 在JDK中我们能够看到有一个java.lang.ref的包.这个包中就是Java中实现强.软.弱.虚引用的包,例如以下: PhantomReference 虚引用: ...
- ssh,hibernate动态映射多表
[From] http://www.07net01.com/2016/01/1172051.html 最近在做OA系统(ssh),一直在想如何把框架架得更完善,此前已经在框架里集成springMVC, ...
- [原创] 浅谈开源项目Android-Universal-Image-Loader(Part 3.1)
最近,总算有时间去做些平时喜欢而没空去做的事情.一直觉得项目中使用的Image Loader适用性不强,昨晚在github随便逛逛,发现一个开源项目Android-Universal-Image-Lo ...
- JNDI 笔记(一) 概述
很多地方都会用到JNDI,一大堆的缩写加上一大堆不清不楚的概念描述,使得在看到的时候都不认识,更不要说使用了. JNDI,Java Naming Directory Interface,J2EE的 ...
随机推荐
- gulp(1) 的使用
1.安装node.js 2.全局安装gulp.js npm install gulp -g 3.在项目本地根目录再安装(通过黑窗口安装)npm install --save-dev gulp/ 或者 ...
- 23Spring使用JdbcTemplate和JdbcDaoSupport
首先需要添加c3p0包和jdbc包 数据库: CREATE DATABASE IF NOT EXISTS `spring` /*!40100 DEFAULT CHARACTER SET utf8 */ ...
- 集训第四周(高效算法设计)I题 (贪心)
Description Shaass has n books. He wants to make a bookshelf for all his books. He wants the bookshe ...
- 集训第四周(高效算法设计)B题 (二分查找优化题)
---恢复内容开始--- Description Before the invention of book-printing, it was very hard to make a copy of ...
- Analyzer原理
[常用分词器] SimpleAnalyzer StopAnalyzer WhitespaceAnalyzer StandardAnalyze [TokenStream] she is a studen ...
- 58. Spring Boot国际化(i18n)【从零开始学Spring Boot】
国际化(internationalization)是设计和制造容易适应不同区域要求的产品的一种方式.它要求从产品中抽离所有地域语言,国家/地区和文化相关的元素.换言之,应用程序的功能和代码设计考虑在不 ...
- Mongo的Replica Sets (复制集)的配置全过程和心得体会
http://blog.csdn.net/bloggongchang/article/details/7272403 一.MongoDB Replica Sets(副本集)简单的说就是有自动故障恢复功 ...
- [NOIP2007] 提高组 洛谷P1005 矩阵取数游戏
题目描述 帅帅经常跟同学玩一个矩阵取数游戏:对于一个给定的n*m的矩阵,矩阵中的每个元素aij均为非负整数.游戏规则如下: 1.每次取数时须从每行各取走一个元素,共n个.m次后取完矩阵所有元素: 2. ...
- android view自定义
转载自:http://blog.csdn.net/iispring/article/details/50708044
- Codeforces Gym100495 B、D、E、F、K
http://codeforces.com/gym/100495 K题 草地的面积减去相交的面积,计算几何,垃圾题,避免不必要的计算损失精度(能约分的约分) 卡了老子一个星期了 再加前几天的一道题 这 ...