define interface method with different parameters in C# -


interface parentinterface {    public string methoda(/*define parameters name , datatype*/); } 

and

public class childa : parentinterface {   public string methoda(string a, int b, string c, long d){} }  public class childb : parentinterface {    public string methoda(int e, string f, string g){} } 

i want define interface method's parameters name , data type

you have 2 different methods

public string methoda(string a, int b, string c, long d){} 

and

public string methoda(int e, string f, string g){} 

that represent 2 different contracts childa , childb respectively. cannot define interface single methoda fits both definitions. seek not possible.

note define both overloads in interface, each class implementing interface have implement both overloads.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -