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的 ...
随机推荐
- NOIP专题复习2 图论-生成树
目录 一.知识概述 二.典型例题 1.口袋的天空 三.算法分析 (一)Prim算法 (二)Kruskal 四.算法应用 1.[NOIP2013]货车运输 五.算法拓展 1977: [BeiJing20 ...
- 集训第五周动态规划 J题 括号匹配
Description We give the following inductive definition of a “regular brackets” sequence: the empty s ...
- package control(转载)
Package Control(扩展包管理器) []Package Control 可以看做是一个ST的扩展管理器,可以去下载.安装.删除 Sublime Text 3的各种插件.皮肤等. [ ...
- Light oj-1100 - Again Array Queries,又是这个题,上次那个题用的线段树,这题差点就陷坑里了,简单的抽屉原理加暴力就可以了,真是坑~~
1100 - Again Array Queries ...
- HDU 2815 扩展baby step giant step 算法
题目大意就是求 a^x = b(mod c) 中的x 用一般的baby step giant step 算法会超时 这里参考的是http://hi.baidu.com/aekdycoin/item/2 ...
- Spring Data JPA 中常用注解
一.java对象与数据库字段转化 1.@Entity:标识实体类是JPA实体,告诉JPA在程序运行时生成实体类对应表 2.@Table:设置实体类在数据库所对应的表名 3.@Id:标识类里所在变量为主 ...
- XMLREADER/DOM/SIMPLEXML 解析大文件
DOM和simplexml处理xml非常的灵活方便,它们的内存组织结构与xml文件格式很相近.但是同时它们也有一个缺点,对于大文件处理起来力不从心,太耗内存了. 还好有xmlreader,基于流的解析 ...
- Codeforces Round #457 (Div. 2) B
B. Jamie and Binary Sequence (changed after round) time limit per test 2 seconds memory limit per te ...
- CODEVS——T 3736 【HR】万花丛中2
http://codevs.cn/problem/3736/ 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题解 题目描述 Description ...
- codevs——1385 挤牛奶
1385 挤牛奶 USACO 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 青铜 Bronze 题解 查看运行结果 题目描述 Description 三个农民每天清 ...