# Multiple Inheritance In C# Using Interfaces

This is the simple mathematical operation program demonstrating how multiple inheritance can be achieved in C# using Interface Concept.

## Multiple Inheritance in C#

Multiple Inheritance can be achieved in C# using Interfaces.

This is the simple mathematical operation program demonstrating how multiple inheritance can be achieved in C# using Interface Concept.

1. using System;
2. using System.Collections.Generic;
3. using System.Linq;
4. using System.Text;
5.
6. namespace MultipleInheritApplication
7. {
8.     interface calc1
9.     {
10.         int add(int a, int b);
11.     }
12.     interface calc2
13.     {
14.         int sub(int x, int y);
15.     }
16.     interface calc3
17.     {
18.         int mul(int r, int s);
19.     }
20.     interface calc4
21.     {
22.         int div(int c, int d);
23.     }
24.     class Calculation : calc1, calc2, calc3, calc4
25.     {
26.         public int result1;
27.         public int add(int a, int b)
28.         {
29.             return result1 = a + b;
30.         }
31.         public int result2;
32.         public int sub(int x, int y)
33.         {
34.             return result2 = x - y;
35.         }
36.         public int result3;
37.         public int mul(int r, int s)
38.         {
39.             return result3 = r * s;
40.         }
41.         public int result4;
42.         public int div(int c, int d)
43.         {
44.             return result4 = c / d;
45.         }
46.
47.         class Program
48.         {
49.             static void Main(string[] args)
50.             {
51.                 Calculation c = new Calculation();
53.                 c.sub(20, 10);
54.                 c.mul(5, 2);
55.                 c.div(20, 10);
56.                 Console.WriteLine("Multiple Inheritance concept Using Interfaces :\n ");
58.                 Console.WriteLine("Substraction: " + c.result2);
59.                 Console.WriteLine("Multiplication :" + c.result3);
60.                 Console.WriteLine("Division: " + c.result4);
62.             }
63.         }
64.     }

Output

Further recommended readings on C# inheritance

Here are more articles on inheritance and object oriented programming in C#.

Types of Inheritance in C#
In this article, we will learn about C# inheritance and types of inheritance in C# and .NET with code examples.

Overview of Inheritance in C#
In this article, you will learn about inheritance in C#. Inheritance is one of the major pillars of object-oriented programming. Here is an overview of inheritance.

Inheritance with Example in C#
Here are some example of inheritance using C#.

Learn all about Inheritance in C#

Playing with inheritance in C#