Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

deep copy c++

// DEEP COPY
class X
{
private:
    int i;
    int *pi;
public:
    X()
        : pi(new int)
    { }
    X(const X& copy)   // <-- copy ctor
        : i(copy.i), pi(new int(*copy.pi))  // <-- note this line in particular!
    { }
};
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #deep #copy
ADD COMMENT
Topic
Name
5+5 =