c# - Why would a developer include a parameter in a function that references the class it is used in? -


so have following situation:

class child : base, ibase {     response onoperationresponse(base base, parameters params)     {        // code code code     } }  public class base {     protected void onoperationresponse(parameters params); }  public interface ibase {     response onoperationresponse(base base, parameters params); } 

i leaving lot out, i've put in parts confusing me.

so, base class , ibase interface both contain same function name, want use interface's onoperationresponse call. getting confused, why developer of library added base parameter interface? shouldn't interface realize function suppose refer this?

am missing here? or there further under hood library hiding?

shouldn't interface realize function suppose refer this?

the parameter of type base being passed in onoperationresponse any instance of type base - why make assumption should same ibase instance being called on?

a use case (totally made admittedly) augmenting or modifying response similar decorator:

class child : base, ibase {     response onoperationresponse(base somebase, parameters p)     {         var response = somebase.onoperationresponse(p);         response.foo = "bar";         return response;     } } 

Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -