可以尝试下使用: // creates a new object on the heap:
new B()
// dereferences the object
*(new B())
// calls the copy constructor of B on the object
B object2 = *(new B()); 另一个样本是: A *object1 = new A(); delete分配的内存: delete object1; ... 展开详请
可以尝试下使用: // creates a new object on the heap:
new B()
// dereferences the object
*(new B())
// calls the copy constructor of B on the object
B object2 = *(new B()); 另一个样本是: A *object1 = new A(); delete分配的内存: delete object1; ... 展开详请