---
title: "Concept of Inheritance"  
description: "In object-oriented programming, inheritance is the concept that when a class of objects is defined, any subclass that is defined can inherit the defin"  
author: "Anonymous User"  
published: 2010-10-07  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/15/concept-of-inheritance  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Concept of Inheritance

##### Inheritance:

In object-[oriented programming](https://www.mindstick.com/forum/162/object-oriented-programming-oop-s), [inheritance](https://www.mindstick.com/articles/13095/inheritance-and-its-types) is the [concept](https://www.mindstick.com/blog/79/routing-concept-in-dot-net) that when a [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp) of [objects](https://www.mindstick.com/forum/145447/what-are-objects) is defined, any subclass that is defined can inherit the definitions of one or more general classes. This means for the programmer that an object in a subclass need not carry its own [definition](https://yourviews.mindstick.com/view/70598/false-furore-over-the-leadership-definition-statement-of-army-chief-bipin-rawat) of data and [methods](https://www.mindstick.com/articles/13060/runny-nose-remedy-methods-that-work-best) that are generic to the class (or classes) of which it is a part. This not only speeds up [program](https://www.mindstick.com/blog/12337/scaling-up-your-mentorship-program) [development](https://www.mindstick.com/articles/65309/importance-of-ux-design-in-the-development-of-mobile-apps); it also ensures an inherent validity to the defined subclass object (what works and is consistent about the class will also work for the subclass).\

##### Sometimes base class known as generalized class and derived class known as specialized class.

##### Example:

```
Class x{    Public static int add (int a,int b)    {        Return (a+b);    }}Class y:X{    Public static int mul(inta,intb)    {        Return(a*b);    }}Static void main(){    X obj=new y();    Obj.add(5,6);}
```

---

Original Source: https://www.mindstick.com/blog/15/concept-of-inheritance

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
