Software Engineering Interview Questions: C++ – constructor, copy constructor and assignment – 1
June 10, 2011 2 Comments
The following two posts cover the topic of constructors, copy constructors and copy assignment operators in C++. At the end of reading these posts, you should be able to answer the following questions:
1. What is the difference between shallow copy and deep copy?
2. What are the functions C++ provides to our classes by default?
3. When should we provide our own copy constructor and copy assignment operator?
The posts have been taken from a file I had written for aiding in preparation for software engineering interviews. The style of exposition in the posts would hence exhibit a marked difference from that of a textbook, and orient itself more towards an informal synopsis written with the express purpose of aiding the understanding of the reader, who is assumed to be familiar with certain C++ concepts.
The pdf file which forms the basis for these two posts is attached here – C-tutorials