About objects (object model)

Source: Internet
Author: User

Simple Object model: as shown in:

Each object is a series of slots, and each data member or function member has its own slot. This model has very low space and execution efficiency. In this model, the members themselves are not placed in object. Only pointers to member are placed inside the object.

Table Driven Model:

Object member variables and member variable functions are each placed in a table with two pointers pointing to the two tables (this model is supported by virtual functions implementation)

C + + object model:

1. nonstatic data Memger placed in each class object

2. Static data members are placed outside of class object

3. Static and nonstatic function members are placed outside of class objects

4. Virtual functions is supported in two steps:

Class produces a pointer to the virtural functions, placed in the table, which becomes the virtural table. Each object is placed with a pointer to the associated virtual table, which becomes the vptr. Vptr settings and resets are completed by constructor, destructor, copy assignment.

Type_info object (which is supported by Rtti) is also indicated by Tirtural table, which is located in the first slot of the table (so there is not only a virtual function address in virtual table)

About objects (object model)

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.