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

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -