15.1--Object-oriented

Source: Internet
Author: User

Data abstraction, inheritance, dynamic binding

(1) in C + +, dynamic binding occurs when a virtual function is called through a pointer or reference to a base class, either to a base class object or to a derived class object

This fact is the key to dynamic binding. A virtual function called with a reference or pointer determines at run time that the called function is the object referred to by the reference or pointer

The actual type.

(2) Any non-static member function can be a virtual function, virtual function virtual Word can only appear in the class body

Access control:

(1) Private member: The private member of the base class can only be accessed by the member functions and friends of the base class.

(2) A derived class can access only public members of the base class and cannot access private (access rights are the same as other programs)

(3) Protected members: derived classes can be accessed, but other ordinary users are still inaccessible.

15.1--Object-oriented

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.