Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Access type control (public, private, protected)

2025-03-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Access control modifiers include public (public, default), private (private), and protected (protected).

1.public

Members of the class have no access restrictions, and all external members can access the members of the class.

2.private

There are no access restrictions for all members of the same class, but external code of the class is not allowed to change or even operate, and for subclasses of the class, there is no access to private-decorated members.

3.protected

It has access to subclasses of this class and subclasses of subclasses, and can read and write properties and methods. However, it cannot be accessed by the external code of the class, nor does the external code of the subclass have access to its properties and methods.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report