Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




If there are two interfaces having same function, and we are creating a class which will derive from those interfaces then how we will implement the definition for that function differently for those two interfaces

public interface I1

{

    void Test();

}

public interface I2

{

    void Test();

}

public class MyClass : I1, I2

{

    void I1.Test()

    {

        int sum = 10 + 20;

    }

    void I2.Test()

    {

        int sum = 100 + 200;

    }

}

Share this article   |    Print    |    Article read by 2144 times
Author:
Guest
Guest user is that user who have done some activity on website without login. Activity contains commenting on any article, uploading an image on website etc.
Related Articles: No related article
Related Interview Questions: