Class inheriting from several Interfaces having same method signature

Posted by Manish on Stack Overflow See other posts from Stack Overflow or by Manish
Published on 2010-05-14T06:11:48Z Indexed on 2010/05/14 6:14 UTC
Read the original article Hit count: 280

Filed under:
|
|

Say, I have three interfaces:

        public interface I1
        {
            void XYZ();
        }
        public interface I2
        {
            void XYZ();
        }
        public interface I3
        {
            void XYZ();
        }

A class inheriting from these three interfaces:

class ABC: I1,I2, I3
{
      // method definitions
}

Questions:

  • If I implement like this:

    class ABC: I1,I2, I3 {

        public void XYZ()
        {
            MessageBox.Show("WOW");
        }
    

    }

It compiles well and runs well too! Does it mean this single method implementation is sufficient for inheriting all the three Interfaces?

  • How can I implement the method of all the three interfaces and CALL THEM? I know it can done using explicit implementation but I'm not able to call them. :(

© Stack Overflow or respective owner

Related posts about c#

Related posts about oops