In the process of learning C + +, summed up the class of three users and the use of permissions, feel very practical

Source: Internet
Author: User

First of all we need to know that the class of three users are: the class of the implementation of the class of ordinary users and classes of the Inheritors (derived classes), and then explain the differences between the various users.

1, the realization of the class: Gu Mingsi, is the designer of the class, with the maximum permissions, you can access any of the members of the class, mainly responsible for writing the class members and friend code. You can access the public part of the class, which protects the partial (protect) and (private) private parts.

2, ordinary users of the class: is to use the object of the class, this part of the user can only access the interface of the class (that is, the common part Poublic).

3, the successor of the class: is the derived class. Derived classes can access the public and protected parts of the base class, and ordinary users cannot access protected members.

As with other classes, the base class should declare its interface members to be common, while the parts that belong to the implementation are divided into two groups: one for the derived class (protect) and one for the Friend access (private) of the base class and base class. After the above summary, we write and C + + classes, we can well consider the issue of permissions.

  

In the process of learning C + +, summed up the class of three users and the use of permissions, feel very practical

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.