---
title: "What is Inheritance?"  
description: "What is Inheritance?"  
author: "Anonymous User"  
published: 2015-02-23  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/2340/what-is-inheritance  
category: "java"  
tags: ["inheritance"]  
reading_time: 1 minute  

---

# What is Inheritance?

**Inheritance is a mechanism**in which one object acquires all the properties and behaviour of another object of another class. It represents IS-A relationship. It is used for Code Resusability and Method Overriding.

## Answers

### Answer by Shrikant Mishra

The derived class inherits the member of the base class is called inheritance. This is one object that has all the properties and behaviors of its parent object. Using inheritance we can reuse the code. We can achieve a single level and multi-level inheritance.

```
public class Employee {
public float salary = 400;
}
public class Programmer: Employee
{
public float bonus = 100;
}
class TestInheritance{
public static void Main(string[] args)
{
Programmer p1 = new Programmer();
Console.WriteLine("Salary: " + p1.salary);
Console.WriteLine("Bonus: " + p1.bonus);
}
}
```

### Answer by Anonymous User

**Inheritance is a mechanism**in which one object acquires all the properties and behaviour of another object of another class. It represents IS-A relationship. It is used for Code Resusability and Method Overriding.


---

Original Source: https://www.mindstick.com/interview/2340/what-is-inheritance

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
