Main content:
1. Object-oriented thinking
Basic features of 2.OOP
3. Concepts and declarations of classes
4. Objects
5. Constructors
6. Destructors
7. Inline function members
8. Copy Constructors
9. Combinations of classes
Class Encapsulation: Allows the consumer to access data (member variables) in a class with specific permissions (private, public, protected) through interfaces (member functions).
Copy constructor: A special constructor whose formal parameters are references to objects of this class.
1. When an object of the class is used to initialize another object of the class, the copy constructor is automatically called to implement copy assignment.
2. If the function's formal parameter is a class object, when the function is called, the argument is assigned to the parameter, and the copy constructor is called automatically by the system.
3. When the return value of a function is a class object, the copy constructor is called automatically by the system.
If the user does not declare a copy constructor for the class, the compiler generates a copy constructor itself. The value of each data member of the object used as the initial value to initialize the corresponding data member of the object that will be established.
Concept of Composition:
The member data in a class is an object of another class.
Forward Reference declaration: (In fact, the name already shows that the role of this technology is a citation statement)
The class is to be declared before it is used. If the class must be referenced before the declaration, a forward reference declaration is required. Only one identifier is referenced for the program, but it is specifically declared elsewhere.
Forward reference declarations cannot: 1. Declaring objects of this class
Use this object in a 2.inline function
Only:
1. The use of declared identifiers cannot involve any details of the class.
Fourth chapter: Classes and objects