Answer to Question #66586 in C++ for Charlotte Baptist
Implement the copy constructor and the operator= so that the Item referenced in the parameter is copied from and assigned to another Item safely and without any memory leak. Also, implement a virtual destructor to ensure that any memory allocated for m_name is freed when the Item is destroyed.
In operator=, if the current object is being set to another Item that is in a safe empty state, the copy assignment operation is to be ignored.
Need a fast expert's response?Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!