Public, protected, internal, and private cannot be the same!

Source: Internet
Author: User
Maybe some new users do not pay much attention to the use of access modifiers in the initial stage of programming, but after the "creation" error, I think most people will take it as an example and pay more attention to it!

The incorrect access modifier may not cause syntax errors of the program, but may cause potential runtime errors, more importantly, it damages the information security of the class (that is, it violates the encapsulation principle) and adversely affects the class members.

Summary:

Public: we can hold a press conference to show off our capital to the masses;

Protected: internal discussions within the team;

Internal: company, organization, foundation... internal communication;

PRIVATE: "I will not say it !" -- Movie "Party A"

What is the difference between code and life and work ?!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.