Inside the C + + Object Model | Object Lessons

Source: Internet
Author: User

1. Added package layout access cost (layout Costs for Adding encapsulation)

virtual function mechanism: used to support efficient execution-time binding

Virtual base class mechanism: implementation avoids duplicate inheritance in inheritance.

2. The C + + Object Model

Pointer-to-member: Avoids the need for different types of member, the member of the object is addressed by the index value of the slot

Data member Table:

member function table:

Virtual table (VTBL): Each object has a pointer (vprt) to vtbl,vptr setting, resetting is automatically completed by the Constuctor, Destuctor, and copy assignment operators of the class. The Type_info object associated with the class (which supports dynamic binding) is also indicated by VTBL and is usually placed at the first slot of the table.

3. A Keyword Distinction

4. An Object distinction

Inside the C + + Object Model | Object Lessons

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.