c++ - operator= override not being used -


i have assignment:

main.cpp

polygon &q = polygonlist->top(); polygon p = q; 

i want use operator override deep copy.

polygon.cpp

polygon& polygon::operator=(const polygon &obj) {     // deep copy here      return *this; } 

polygon.hpp

public:     polygon& polygon::operator=(const polygon &obj); 

any idea why not hitting overide?

edit know not because debugger isn't breaking on return of override

you initializing p using copy constructor.

instead of polygon p = q;, try:

polygon p; p = q; 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -