Overloading c# variable -
i'm little new c# , i've achieved i'm confused why has been allowed.
public interface ibase { } public interface isub : ibase { } public class thing { protected ibase provider; public thing(ibase provider) { this.provider = provider; } } public class anotherthing : thing { protected isub provider; public anotherthing(isub provider) : base(provider) { this.provider = provider; } }
i hope i'm being dense, don't understand how allowed override provider
without causing confusion compiler.
the code work.
i'm surprised not getting warning either.
what doing hiding protected member provider
providing new declaration in derived class. allowed, should decorate declaration new keyword make more explicit intended hide member , not accident/oversight.
Comments
Post a Comment