- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# Example for MultiLevel Inheritance
Multilevel Inheritance occurs when a derived class is formed from another derived class.
Grandfather, father, and son are the perfect example to represent Multilevel Inheritance in C# −
Example
The following is an example stating the usage of multilevel inheritance in C#.
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Demo { class Son : Father { public void DisplayTwo() { Console.WriteLine("Son.. "); } static void Main(string[] args) { Son s = new Son(); s.Display(); s.DisplayOne(); s.DisplayTwo(); Console.Read(); } } class Grandfather { public void Display() { Console.WriteLine("Grandfather..."); } } class Father : Grandfather { public void DisplayOne() { Console.WriteLine("Father..."); } } }
Output
Grandfather... Father... Son..
- Related Articles
- C# Example for Hierarchical Inheritance
- C# Example for Single Inheritance
- Multilevel inheritance in Java
- MultiLevel Inheritance in Dart Programming
- Java Runtime Polymorphism with multilevel inheritance
- Creating a Multilevel Inheritance Hierarchy in Java
- Inheritance in JavaScript with example
- What is Inheritance in Java? Explain with an example
- Flatten a multilevel linked list in C++
- C# and Multiple Inheritance
- Multiple Inheritance in C++
- Explain Inheritance vs Instantiation for Python classes.
- Multilevel $group using MongoDB
- Delegation vs Inheritance in C#
- Interfaces and Inheritance in C#

Advertisements