.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Forum >> OOPS >> Post New QuestionBookmark and Share Subscribe to Forum

Real time example of Multiple Inheritance in C#

Posted By: Karthikeyan Anbarasan     Posted Date: January 03, 2011    Points:2   Category :OOPS
Can any one give me a real time example of Multiple inheritance using interface in C# ?

Author: Gautam Kanaujia             
Posted Date: January 04, 2011     Points: 5   

Please follow below links.

Author: Sadhuryan             
Posted Date: January 05, 2011     Points: 5   

Dear Gautam,

Real Time Example#1

When you trying swipe debit card at other bank ATMs, it will request your data from parent bank.

Real Time Example#2

A Parent has 4 kids. All the kids has their own rights to consume property of their parent.

Is this enough..?

Author: Vinodh             
Posted Date: September 18, 2011     Points: 20   

Child Parent GrandParent relationship.

Author: Baimey Rajesh             
Posted Date: August 01, 2012     Points: 20   

Using interface helps us do multiple inheritance
Another benefit to this technique is something called "Implementation Hid ing". Implementation Hiding allows the methods from the implemented interface to be hidden from the derived class unless the developer explicitly calls the interface. This technique obviously reduces the clutter for a developer.

Two types of Inheritance:
1. Implementation Inheritance: in which class inherits one class and implement/override its methods and properties for example Control object in which System.Windows.Forms.Textbox,System.Windows.Forms.Button both inherits their self from control class. But provides different functionality
2. Interface inheritance: in which a class inherits from Interface. For example IDisposable. It just inherits definition not implementation. Any type which does interface inheritance it means that it will provide defined functionality called as “Contract”.

C# doesn’t support by Implementation inheritance but supports using Interface Implementation

Author: Baimey Rajesh             
Posted Date: August 01, 2012     Points: 20   

implementing an interface in a class essentially means:
"This class MUST define the functions (and parameters) in the interface" .

Interface is used to restrict and access the methods or events etc from differents classes at any cost, It means we can defined many more methods inside any class but when we are calling methods through Interface means we want only other than restricted methods. In the program below User1 can use Read & Write both but User2 can Write and Execute.

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend