简体   繁体   中英

Effects by changing windows form C# Methods from Private to Public

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.

It won't affect your application in terms of functionality. Access modifiers (private/public/...) are used for encapsulation , so you should think carefully what methods can be the part of public interface.

private stuff >>> then we can't see and we don't have persmission to know it like your visa card number for example

public stuff >>> is like your post now we have permission and can see it

protected stuff >>> just you and your family who can know it and noother one have permission to know it

when you build a class or method you have to determin the security of this part use private with the methods or fields that will just be used within your class and no other classes have permission to see it

use public with the things that you want your class to share it with all classes

use protected with stuff that you want only the family of this class can see though inheritance

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM