且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

有关复制构造函数的问题

更新时间:2022-12-13 22:07:56

假定 a2 A 的实例,这将调用复制构造函数.

Assuming a2 is an instance of A, this calls the copy constructor.

它将调用 operator new 来获取对象的动态内存,然后它将新对象复制-构造到内存中,然后返回指向该内存的指针.

It will call operator new to get dynamic memory for the object, then it will copy-construct a new object into the memory, then return a pointer to that memory.