[boolan-c++ Study notes] second week finishing

Source: Internet
Author: User

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

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.