---
title: "Method Overriding in C# Net"  
description: "Overriding a method is  to change the behavior of the method for the derived class. Overriding is done  using inheritance and virtual functions. Examp"  
author: "Uttam Misra"  
published: 2010-07-16  
updated: 2020-03-04  
canonical: https://www.mindstick.com/articles/83/method-overriding-in-c-sharp-net  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Method Overriding in C# Net

Overriding a [method](https://www.mindstick.com/forum/166/webservice-method) is to change the [behavior](https://www.mindstick.com/forum/159354/runtimeexception-and-exception-behavior) of the method for the [derived class](https://answers.mindstick.com/qa/30686/what-is-a-base-class-and-derived-class).

Overriding is done using [inheritance](https://www.mindstick.com/articles/80/inheritance-in-c-sharp) and [virtual](https://yourviews.mindstick.com/view/81602/top-5-virtual-credit-card-providers-in-india) [functions](https://www.mindstick.com/forum/34086/jquery-callback-functions).

**Example**

To [explain the concept](https://www.mindstick.com/forum/158822/explain-the-concept-of-abstract-classes-and-their-significance-in-oop) of overriding I have created two classes Poly

and abc(inherits poly).

```
    public class poly    {    //these two functions, sum(), are overloaded.        public int sum(int x, int y)        {            return (x + y);        }        public virtual int sum(int x, int y, int z)        {            return (x + y + z);        }    }     public class abc : poly    {   //overriding function sum(), of base class poly        public override int sum(int x, int y, int z)        {            return (x + y + z + 10);        }    }
```

---

Original Source: https://www.mindstick.com/articles/83/method-overriding-in-c-sharp-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
