ACM Home Page
Please provide us with feedback. Feedback
The treatment of deep vs. shallow copy in introductory C++ textbooks
Full text PdfPdf (285 KB)
Source ACM SIGCSE Bulletin archive
Volume 35 ,  Issue 2  (June 2003) table of contents
COLUMN: Reviewed papers table of contents
Pages: 99 - 102  
Year of Publication: 2003
ISSN:0097-8418
Author
Stephen P. Carl  Wright State University, Dayton, Ohio
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 5,   Downloads (12 Months): 68,   Citation Count: 0
Additional Information:

abstract   references   peer to peer  

Tools and Actions: Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/782941.782990
What is a DOI?

ABSTRACT

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.


REFERENCES

Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.

 
1
 
2
Owen L. Astrachan. A Computer Science Tapestry. 2/e, McGraw-Hill, 2000.
 
3
James P. Cohoon and Jack W. Davidson. C++ Program Design. 3/e, McGraw-Hill, 2002.
 
4
Deitel and Deitel. C++ How to Program. 3/e, Prentice Hall, 2001.
 
5
 
6
 
7
Jo Ellen Perry and Harold D. Levin. An Introduction to Object-Oriented Design in C++. Addison-Wesley, 1996.
 
8
 
9

Peer to Peer - Readers of this Article have also read: