Sword refers to offer notes

Source: Internet
Author: User

1. When defining the value assignment descriptor member function of a class, pay attention to the following points:

1) determine whether to assign a value to yourself

2) the return value is a reference to the const class (for continuous assignment)

3) The parameter is a reference to the const class.

4) if a pointer exists in the data member, make sure to copy it in depth and release the memory pointed to by the pointer.


2. The copy constructor of the class must not use this type of variable as a parameter, and will not be able to compile it. If a variable is used, the form parameter and the real parameter must be copied, and the copy constructor will be called again. This leads to an endless loop until Memory leakage.



Sword refers to offer notes

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.