Item-11 Handle self assignment in operator=
· โ 4 min read
Solve self assignment situation in operator= by comparing addresses of source and target objects, careful statement ordering, and copy-and-swap
.
Solve self assignment situation in operator= by comparing addresses of source and target objects, careful statement ordering, and copy-and-swap
.
If a class has any virtual functions (for polymorphic purpose), it should have a virtual destructor.
Declare unwanted member functions private without implementations to disallow functionality automatically provided by compilers.