1. For a class of type string (containing pointers)
The pointer members have the flexibility to request storage space, but the pointer operation has the risk of a memory leak, and the operation of the change pointer needs to be particularly cautious.
The point is to write Bigthree.
constructor function
{
Completion of member initialization (list);
Request to complete storage space;
}
Copy constructor
{
Copy members;
Request a new storage space and copy the contents of the Parameter object;
}
Copy Assignment function
{
Check whether to assign value to itself;
Complete copies of general members;
Delete the space of the pointer member in the current object;
According to the new object and copy the content;
}
2. Life cycle
Stack is the memory space of the scope, storing the parameter return value, etc.
Heap is a system-provided GLOBALMEM
3. New
The new keyword requested a different memory space debug (larger) and release state, but all have memory alignment requirements.
[boolan-c++ Study notes] second week finishing