C + + essay (III.)

Source: Internet
Author: User

1.SStud Structural Body

Sstud SS =s2;//Stack Internal copy construction

Sstud sss (s2);//copy construction in stack

Sstud *ps = new Sstud (s2);//copy construction inside the heap

Copy constructor:

Only one of the constructor parameters is Sstud &ss (pointer), the copy constructor is characterized by the fact that there is only one parameter and the type is a reference to the object of this class, and the SS is actually a pointer variable

2. Destructors must have no return value and cannot have parameters

How many times do you construct a general structure?

Application in the stack, when there are more than one constructor, is the first structure of the post-destructor, the first structure of the destructor

To manually refactor the application in the heap

C + + essay (III.)

Related Article

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.