C++ (2nd ed.): an introduction to computing
C++ (2nd ed.): an introduction to computing
Starting out with C++ (2nd ed.)
Starting out with C++ (2nd ed.)
Absolute C++
Structured and Object-Oriented Problem Solving: An Introduction to C++
Structured and Object-Oriented Problem Solving: An Introduction to C++
Problem Solving, Abstraction, and Design Using C++
Problem Solving, Abstraction, and Design Using C++
C++ Program Design
Hi-index | 0.00 |
The default behavior of C++ compilers is to generate a destructor, copy constructor, and assignment operator for each class defined in source code, if that class does not provide such. The constructor and assignment operator generated perform a shallow copy of objects, which is incorrect behavior for most objects that contain pointers. Students must be taught to provide these operators, and to write the copy constructor and assignment operator such that they perform a deep copy of objects. A survey of introductory C++ texts shows that some authors do not explain this important topic in a consistent or thorough way. Any instructor beginning to teach C++ needs to understand this or face the prospect of long hours debugging what otherwise would seem to be a straightforward assignment.