Why are my privates accessible?

后端 未结 5 853
温柔的废话
温柔的废话 2021-01-19 05:47

I have the following code:

public class PersonInitializer
{
    private Person _person;

    public static Person LoadFromFile(string path)
    {
        Per         


        
5条回答
  •  渐次进展
    2021-01-19 06:27

    This is because you are accessing it from a member function. If you want to prevent access from that particular function, you may want to move that static function to a new class.

提交回复
热议问题