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
.
Item-10 Have assignment operators return a reference to *this
· โ 1 min read
Item-8 Prevent exception from leaving destructor
· โ 3 min read
Item-7 Declare destructor virtual in polymorphic base classes
· โ 3 min read
If a class has any virtual functions (for polymorphic purpose), it should have a virtual destructor.