What is an override modifier in C# programming language?

 Posted by Goud.Kv on 9/1/2014 | Category: C# Interview questions | Views: 1535 | Points: 40
Answer:

override modifier is used for abstract or virtual classes to extend them or to modify them. It is basically used in the derived classes to give a new implementation to the base class methods.
We cannot override a static method.
abstract class MyClass              // This is an abstract class.

{
public abstract int Function(); // This is an abstract method.
.........;
........;
}
class YourClass : MyClass
{
public override int Function() // Overriding Base class method.
{
.......;
.....;
}
}


Asked In: Spotted While Learning | Alert Moderator 

Comments or Responses

Login to post response