c# - Why can i change an implementation of property defined in interface in the class -


i trying understand if create interface itest defines 1 property version getter in it. when implement interface in test class can change definition of property getter , setter. how can change implementation of interface shown below?

internal interface itest     {          int myproperty { get;}         void changevalue();     }        public class test : itest     {         public int myproperty         {             get;             set;         }          public void changevalue()         {         }     } 

suppose have

interface itest2 {      int myproperty_get(); } 

it's not surprise can implement interface class

class test2 : itest2 {     private int myproperty;     public int myproperty_get()     {          return myproperty;     }      //not in interface..     public void myproperty_set(int value)       {          myproperty = value;     } } 

you can add set function class implementation, though no set function defined in interface. compiler doesn't object. that's you're doing in original example.


Comments

Popular posts from this blog

methods - python can't use function in submodule -

Java 3D LWJGL collision -

c# - ErrorThe type or namespace name 'AxWMPLib' could not be found (are you missing a using directive or an assembly reference?) -