---
title: "Concept of Overriding"  
description: "Method overriding isthe mechanism same method name with same arguments and return types associatedin a class and its subclass. Overriding is mainly u"  
author: "Anonymous User"  
published: 2010-10-07  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/19/concept-of-overriding  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Concept of Overriding

[Method overriding](https://www.mindstick.com/articles/12227/method-overloadind-and-method-overriding-in-c-sharp) isthe mechanism same [method name](https://www.mindstick.com/forum/33583/selector-creation-with-method-name-and-parameter) with same [arguments](https://answers.mindstick.com/qa/92535/what-are-the-different-types-of-arguments) and return types associatedin a class and its subclass. Overriding is mainly used in functions.Overriding is an object-[oriented programming](https://www.mindstick.com/forum/162/object-oriented-programming-oop-s) feature that enables a [child class](https://www.mindstick.com/forum/159389/how-to-remove-child-class-from-active-div) to provide different [implementation](https://www.mindstick.com/forum/33764/how-to-implementation-of-class-in-c-sharp) for a method that is already defined and/or implemented in its parent class or one of its parent classes. The overriden method in the child class should have the same name, [signature](https://www.mindstick.com/interview/516/explain-about-xml-signature), and [parameters](https://www.mindstick.com/articles/87/passing-parameters-in-c-sharp) as the one in its parent class.

Only those methods are override that methods are declaredwith keyword virtual in the [base class](https://www.mindstick.com/blog/116/base-class-initilization).

##### Example:

```
Class A{    Virtual void add(int a, int b)    {          Return(a+b);    }}Class B:A{    Public override void mul(int a, int b)    {        Return(a*b);    }}Static void main(){    A obj=new A()    Obj.add(5,6);    B obj1=new B();    Obj.mul(5,9):}
```

---

Original Source: https://www.mindstick.com/blog/19/concept-of-overriding

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
