9
Reply

Method overloading is possible in interface ?

Rajesh Singh

Rajesh Singh

9y
2.2k
0
Reply

    Yes we can Interface IBase {int Method(int s,int p);int Method(int q); }

    Yes it's possible, but I would never prefer it and force the users to overload it if they don't need it. I can simply create two interfaces and let the users implement if they need, it will be more flexible and maintainablepublic interface IDoSomethingInterface // discard this interface {void DoSomething(String x);void DoSomething(int a); }public interface IDoSomethingInterfaceWitString {void DoSomething(String x); }public interface IDoSomethingInterfaceWithInt {void DoSomething(int a); }

    Yes. Its possible to overload the method in interface.

    yes

    Yes we can do method overloading in Interface.

    yes .

    Yes, it is

    Yes, it is possible but found it has been rarely used

    yes,public interface bas1 {void Disp1();void Disp1(int x);}abstract class MyClass : bas1{public void Disp1(){throw new NotImplementedException();}public void Disp1(int x){throw new NotImplementedException();}}