C # access modifiers such as learning

Source: Internet
Author: User

C #LearningClass access modifier. Class, the same assembly, the same assembly, other classes, different assembly, the derived classes, different assembly, and other classes ......

Priavte
Protected
Internal
Public

Public: The method to select it is to include the public modifier in the member declaration. The intuitive meaning of public is "unrestricted access ".

Protected: The method to select it is to include the protected modifier in the member declaration. The intuitive meaning of protected is "the access scope is limited to the class to which it belongs or the type derived from this class ".

Internal (default). The method to select it is to include the internal modifier in the member declaration. The intuitive meaning of internal is that "access scope is limited to this program ".

Protected internal (meaning protected or internal). The method to choose it is to include the Protected and internal modifiers in the member declaration. The intuitive meaning of protected internal is "access scope is limited to this program or the types derived from the classes it belongs ".

Private: the method to select it is to include the private modifier in the member declaration. The intuitive meaning of private is that "access scope is limited to the type it belongs ".

Related Article

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.