he override modifier is required to extend or modify the abstract or virtual implementation of an inherited method, property, indexer, or event.
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.Syntax:
public override returnType functionName()
public virtual void Y()
// Used when C is referenced through A.
class B : A
public override void Y()
// Used when B is referenced through A.
class C : A
public void Y() // Can be "new public void Y()"
// Not used when C is referenced through A.
static void Main()
// Reference B through A.
A ab = new B();
// Reference C through A.
A ac = new C();
All information of this service is derived from the free sources and is provided solely in the form of quotations.
This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 837 / . Delta: 0.02812 с