Deep copy of object c++ overloading operator assignment -
i trying understand deep , shallow copy concept , apply it. class composed of :int* num, bool signe , int pos. copy not working well, know why?
cbigint & operator= (const cbigint & other) { if (this != &other) { int * new_array = new int[30000000]; std::copy(other.num, other.num+ other.pos+ other.signe, new_array); delete [] num; num = new_array; pos = other.pos; signe=other.signe; } return *this; }
Comments
Post a Comment