Hello All,
i have a Windows form application based on C#, i would like to change few of its methods from Private to Public in order to use them in Matlab, I am quite new to handle this, please let me know how it will impact my application?
Is there any consequences? is it safe to do that?
Thanks in advance.
Impact : Changing C# Methods from Private to Public
224318-Mar-2015
Updated on 18-Mar-2015
Samuel Fernandes
18-Mar-2015No, you can hide a public member with a private method in a subclass, but you cannot override a public member with a private one in a subclass. And, in actually, it's not just a public/private thing, this applies to narrowing the access in general.
Revised: By hiding with a more restrictive access - in this case private access - you will still see the base class member from a base-class or sub-class reference, but it would defer to the new method when available from the new access level.
So in general, when you hide, the hide takes precedence when visible at its access level. Otherwise the original method is the one used.