3.7.3 Access Control

Source: Internet
Author: User

Access control refers to the access attributes of members in the class. VB. NET has several access control levels, which are listed in Table 3-7.

Table 3-Access Control for Class 7 members
Access control level description
There is no access restriction for Public class members. To construct a public class member, you can use the public keyword before the class member name to access the public member. For example, the PrintSalary method in the Employee class is a public method that can be called by anyone and functions.
Private class members can only be accessed within the class. Private Key words are used to declare Private class members.
Protected protects members from being accessed by class members and their inherited classes. Use the keyword Protected to define the Protected members.
Friend meta access is restricted in programs that declare this type, and a Friend Meta is declared using the keyword "Friend ".
Combination of Protected friend protected and friend

BibliographyPrevious sectionNext section

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.