Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

Part 31 - C# Tutorial - Explicit interface implementation


Part 31 - C# Tutorial - Explicit interface implementation


4 comments:

  1. thank you so much Venkat your a live saver

    ReplyDelete
  2. Hi Venkat,
    thanks a lot, your tutorial is very clear, as always. I was missing a couple of irrelevant things when you explained explicit and default implementation of methods. The first one is that in your example, if you use explicit implementation of InterfaceMethod() for both interfaces, I1 and I2, without removing the default implementation, you will be able to call 3 different implementations of InterfaceMethod(), with or without casting.
    The second one is this: if you don't explicitly implement InterfaceMethod() for interface I1 in the class Program P, then, if you invoke InterfaceMethod() like this: ((I1).P).InterfaceMethod(), the default (public) implementation of InterfaceMethod() will be executed.
    These are details, I know, and they are intended only as a little adjunct to your excellent explanation!
    Thank you!

    ReplyDelete
  3. @v.hradil exactly what would you like to ask here...

    ReplyDelete
  4. HI, I am just wondering that why can't we have explicit implementation of methods on classes with multiple inheritance(on classes) to avoid the diamond problem like the same way we are avoiding it on interface(while multiple implementation)? I would appreciate Any explanation.

    ReplyDelete

It would be great if you can help share these free resources