c# - Two interfaces have same method -


interface {     int add(int a,int b); }  interface b {     int add(int a,int b); }  class d : a, b {     int add(int a,int b)     {         return a+b;     } } 

code works fine , didn't produce error. class d using interface's method?

neither, since neither interface has method, merely method signature. method in d implements signature provided both interfaces, works.

remember, interface merely specifies signatures of methods must exist in implementation.


Comments

Popular posts from this blog

c++11 - Intel compiler and "cannot have an in-class initializer" when using constexpr -

rest - Spring boot: Request method 'PUT' not supported -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -