📜  深拷贝 C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:49.425000             🧑  作者: Mango

代码示例1
//SHALLOW COPY
class X
{
private:
    int i;
    int *pi;
public:
    X()
        : pi(new int)
    { }
    X(const X& copy)   // <-- copy ctor
        : i(copy.i), pi(copy.pi)
    { }
};