Before reading this article, I highly recommend reading the previous part of the series,
Inheritance
Inheritance is a property of OOPs (Object Oriented Programming) language. that is used to derive new class from already existing class. There are 5 types of Inheritance,
- Single Inheritance
- Multilevel Inheritance
- Multiple Inheritance
- Hybrid Inheritance
- Hierarchical Inheritance
Multiple Inheritance
In Multiple Inheritance one new class get derived from two base classes as in the following figure,

Figure: Multiple Inheritance
The above example show that there is one class Class C that gets derived from two base classes Class A and Class B.
Example
- Class UGC
- String UgcCode, UgcAdress;
- Public void Get()
- {
- Console.WriteLine(“Enter the Ugc Code and Adress: ”);
- This.UgcCode = Console.ReadLine();
- This.UgcAdress = Console.ReadLine();
- }
- Public void display()
- {
- Console.WriteLine(“UGC Code is: ”+This.UgcCode);
- Console.WriteLine(“UGC Office Adress is: ”+This.UgcAdress);
- }
- Class university: UGC
- String ucode, Uname, UAddress, Utype
- Public void Get()
- {
- Console write(“enter the university Code, Name, Adress and Type details: ”);
- This UCode = console Readline();
- This UName = console Readline();
- This UAddress = console Readline();
- This Utype = Console readline();
- }
- Public void Display()
- {
- Console.WriteLine(“University Code is: ”+This.UCode);
- Console.WriteLine(“University Name is: ”+This.UName);
- Console.WriteLine(“University Adress is: ”+This.UAdress);
- Console.WriteLine(“University Type is: ”+This.UType);
- }
- Class Class: University
- String Ccode, Cname, CAddress, Ctype
- Public void Get()
- {
- Console write(“enter the College Code, Name, Adress and Type details);
- This CCode = console Readline();
- This CName = console Readline();
- This CAddress = console Readline();
- This Ctype = Console readline();
- }
- Public void Display()
- {
- Console.WriteLine(“University Code is: ”+This.CCode);
- Console.WriteLine(“University Name is: ”+This.CName);
- Console.WriteLine(“University Adress is: ”+This.CAdress);
- Console.WriteLine(“University Type is: ”+This.CType);
- }
- Class InterfaceImplimentation
- Public void Main()
- {
- College obj = new College();
- Obj.Get();
- Obj.Display();
- }
- }
- Console.ReadLine();
- }


Hemalatha SunnapuPosted Jul 6, 2018, 12:29 PM
Where is College class ,with out class ,how can you code like this "College obj = new College();" ?please let me know answer ,because i have another question to you people
Joe WilsonPosted Dec 26, 2015, 3:40 AM
Well, it was so great.
Chamuth ChamandanaPosted Dec 22, 2015, 1:52 AM
You've explained the OOP Concept really well! Thanks Sir!