1. the const of a common member function must appear in the declaration and definition.
2. The member functions of the class can only reload other member functions of the class. member functions are irrelevant to non-member functions outside the class and member functions of other classes.
3. The member functions defined in the class are automatically processed as inline.
4. It is valid to specify the inline in the declaration and definition of the member function. You can select any position. However, because the inline function must be visible in every source file that calls it, the inline function not defined in the class definition should usually be placed in the same header file of the class definition.
5. The declaration of a class is an incomplete type and does not know the details of the class. Therefore, objects of the class cannot be defined. Only pointers and references can be defined to declare the form parameters and return types. Therefore, the class object cannot be defined as a data member. It can only be a pointer or reference.
6. explicit reference to this in a member function is usually unnecessary, but this must be done in one case: When we need to reference an object as a whole instead of referencing a member of the object. The most common case is that the function returns a reference to the object that calls the function. (Classa & classa: doit () {return * This ;})
7. In a very member function, this is a const pointer to the class type. You can change the value that this points to and cannot change the address saved by this. In a common member function, this is the const pointer to a const class object. It neither changes the object to which this points, nor changes the address saved by this. A common reference to a class object cannot be returned from a common member function. When declaring a function, it must be a reference of Const. The benefit of returning a reference is that you can concatenate a series of operations (A. B (). C (). d ();). However, B may be a common member function, rather than C. It is not feasible to call a very member function on the const object. The solution is to overload B. One is const and the other is not Const.
8. Sometimes you want the data member of the class to be modified in the common member function. You can declare the data member as a variable data member and put mutable in front of the Declaration.
9. Const cannot be const. A constructor initializes an object regardless of whether the object is const.
10. Members that must be initialized in the initialization list: a) Class Members without default constructor, B) const Member, c) reference type members.
11. The order of the initialization list is not the order in which the members are initialized, but the order in which the members are defined.
12. You can pass the expression of the form parameter to the initialization formula (x (int v): I (V), J (V * V) {}) in the initialization list ){}).
13. A class should usually define a default constructor. The initial value provided to members in the default constructor should indicate that the object is empty.
14. static data members can be declared as any type, constants, references, arrays, and class types. It must be defined outside the class definition body. Static members are not common members and cannot be initialized in the constructor, but are initialized during definition. But when it is static const int, You can initialize it in the class definition body, but it must still be defined out of the class definition.
15. static member functions are not part of any object, so they cannot be declared as Const. Static member functions cannot be declared as virtual functions.
16. When defining static data members and static member functions outside the class, you do not need to specify static reserved words again.
17. If a class definition contains a custom constructor, the compiler does not provide the default constructor. However, even if there is a custom constructor, the compiler also provides a copy constructor.
18. To prohibit replication, the copy constructor must be explicitly declared as private. Because if you do not write a compiler, it will be combined into a default one.
19. If the class does not define its own value assignment operator, the compiler will generate one. Classes that can use the composite copy constructor can also use the composite value assignment operator. If the class needs to define the copy constructor, it also needs to define the value assignment operator, consider these two operations as one unit. If one of them is needed, the other is required.
20. Many classes do not need explicit destructor. destructor are usually used to release resources obtained during the constructor or object life cycle.
21. If the class requires destructor, it also requires the value assignment operator and the copy constructor.
22. Unlike the copy constructor or value assignment operator, the compiler will always synthesize a constructor for us. Even if we have already written one, the synthesis constructor will still run. The compositing destructor destroys each non-static member in reverse order of the declared order of the members in the class.