Access modifier of C,

Source: Internet
Author: User

Access modifier of C,

OneAccess ModifierDefines the range and visibility of a class member to encapsulate the class. C # The supported access modifiers are as follows:

  • Public // The Public access modifier allows a class to expose its member variables and member functions to other functions and objects. Any public member can be accessed by external classes.
  • Private // The Private access modifier allows a class to hide its member variables and member functions from other functions and objects. Only functions in the same class can access its private members. Even a class instance cannot access its private members.
  • Protected // Protected access modifierAllows a subclass to access its base classMember variables and member functions. This helps implement inheritance.
  • Internal // Internal access specifiers allow a class to expose its member variables and member functionsCurrent assemblyOther functions and objects. In other words, any member with an internal access modifier can be accessed by any class or method defined in the application defined by the Member.
  • Protected internal // The Protected Internal access modifier allows a class to hide its member variables and member functions from class objects and functions other than the child classes in the same application. This is also used to implement inheritance.

Note:

1. The program compiled into the same dll or exe is in the same assembly, and the program in different dll or exe files is in different assembly.

2. The Assembly in. net is a dll or executable exe file directly generated by a compiler, including the Assembly List, metadata, and MSIL. Is a collection of one or more types of definitions and resource files.

From the W3C website.

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.