Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道有很多关于信息隐藏的文章,但我仍然不知道为什么我不应该将类属性定义为公共的。
如果我将属性定义为“公共”,会有什么后果?
请举个例子。
将属性定义为“公共”后,您将能够从任何地方访问它,因此出于安全原因,您必须将其设为“私有”,尤其是当您与团队合作时,“私有”属性意味着它是一个敏感的!就这样。