C ++ object model reading note

zhaozj2021-02-17  74

1. What is a C object model 1, and the language directly supports some of the object-oriented program design, and various supported underlying implementation mechanisms.

2, the C language is the process-oriented process: the language itself does not support the correlation between data and functions, which is procedural, distributed in each function-oriented function that they handle common external data. C implements independent "abstract data type" ADT

3, C in the layout and the main amount of Virutal, the main amount of Virutal, the Virtual Function mechanism 2, the Virtual Base Class, multiple inherited the base class in the system, there is a single-shared entity

4, C has two kinds of member data types [Class Data Type]: static, nonStatic has three kinds of member function types [Class Member Function]: Static, NonStatic, Virtual

5, C Object Model NonStatic Data MEMBER Non-Static Data Members are placed in the class object Static Data MEMBER static member function is placed in all type objects [is placed in the Data segment] static function and nonStatic function Static function in the class object is similar to the Nonmember Function Virtual Function 1, each class generates a pointer to the Virtual Function, placed in the table Virtual Table (VTBL) 2, and the class object adds a pointer. Point VTBL for VPTR

6. In the case of virtual inheritance, Base Class is derived in the inheritance series, there is only one entity SubObject.

7, keywords Struct and Class Differences: struct reflects the concept of data extraction Class reflects ADT (Abstract Data Type concept I seem to be the difference in thinking, there is no other difference

8, the C program design model directly supports three "program design models", that is, not just OO 1, program model: process-oriented design 2, abstract data type model: I seem to explain data extraction Struct 3, object-oriented model

9, a pointer, no matter which data type it does, the memory size required by the pointer itself is fixed, pointing to the difference between the pointers of different types, that is, the difference between its pointer representation, is not different, And it is the different type of Object type, I seem to have different ways of processing the compiler in order to notify the compiler.

10. Is the polymorphism refers to the use of virtual functions?

11. When a base class is directly initialized (or specified as) one inherited class, the inheritance class will be cut to plug in less product memory.

12, if a class does not have a custom constructor, the compiler generates a constructor that has a constructor, but this constructor is a synthetic constructor without a specific role, only satisfying the needs of the compiler, not the program. The constructor that needs to be synthesized only for the initialization of the base class object and the class object member function, and does not initialize other non-static Data Member not any categories that have no provincial constructors will be synthesized.

13, the inline function has a static connection. It will not be seen by the file. If the inline function is complicated, it is not suitable for the inner function, the compiler synthesizes a clear, non-inline function entity.

14. If a class contains one or more class object member functions, the constructor of the class calls the but the genetic constructor of each class object.

15. Copy constructor is a parameter of the class is the constructor of its class name. If the user is not clearly defined, the internal use of the so-called default memberwise initialization, that is, the provincial initialization method of each member function is completed according to Bit. Copy constructor 16, insist on all Member initialization operations completed in the Member Initialization List, the order of initialization is not completed in the order in the initialization, is completed in the order in the class, the compiler is compiled, and the Initialization is placed in the constructor user. Customized code

17, an empty class is not empty, there is a concealed 1 byte, when the compiler is inserted with a char number, so that this class allocates a unique address in memory. I don't know if all editors are? ]

18. The size of the class is related to the machine and editor. It is subject to the impression of three factors. The additional burden caused by the language itself 2, the compiler is optimized for special circumstances 3, Alignment limits, Alignment is a number Integer, such as 32-bit computers, generally 4 bytes 19, regardless of how many objects produce, static data members will only exist in an entity

转载请注明原文地址:https://www.9cbs.com/read-31264.html

New Post(0)