programminga general overview the main problem occurs in class that contains data member that is pointer we will describe the problem and solutions in detail in for nowwe can sketch the problem suppose the class contains single data member that is pointer this pointer points at dynamically allocated object the default destructor does nothing to data members that are pointers (for good reason--recall that we must delete ourselvesfurthermorethe copy constructor and copy assignment operator both copy the value of the pointer rather than the objects being pointed at thuswe will have two class instances that contain pointers that point to the same object this is so-called shallow copy typicallywe would expect deep copyin which clone of the entire object is made thusas resultwhen class contains pointers as data membersand deep semantics are importantwe typically must implement the destructorcopy assignmentand copy constructors ourselves doing so removes the move defaultsso we also must implement move assignment and the move constructor as general ruleeither you accept the default for all five operationsor you should declare all fiveand explicitly definedefault (use the keyword default)or disallow each (use the keyword deletegenerally we will define all five for intcellthe signatures of these operations are ~intcell)intcellconst intcell rhs )intcellintcell &rhs )intcell operatorconst intcell rhs )intcell operatorintcell &rhs )/destructor /copy constructor /move constructor /copy assignment /move assignment the return type of operatoris reference to the invoking objectso as to allow chained assignments = = though it would seem that the return type should be const referenceso as to disallow nonsense such as ( = )=cthat expression is in fact allowed in +even for integer types hencethe reference return type (rather than the const reference return typeis customarily used but is not strictly required by the language specification if you write any of the big-fiveit would be good practice to explicitly consider all the othersas the defaults may be invalid or inappropriate in simple example in which debugging code is placed in the destructorno default move operations will be generated and although unspecified copy operations are generatedthat guarantee is deprecated and might not be in future version of the language thusit is best to explicitly list the copy-and-move operations again~intcellcout <"invoking destructor<endlintcellconst intcell rhs defaultintcellintcell &rhs defaultintcell operatorconst intcell rhs defaultintcell operatorintcell &rhs default/destructor /copy constructor /move constructor /copy assignment /move assignment alternativelywe could disallow all copying and moving of intcells intcellconst intcell rhs deleteintcellintcell &rhs deleteintcell operatorconst intcell rhs deleteintcell operatorintcell &rhs delete/no copy constructor /no move constructor /no copy assignment /no move assignment