Advanced C++: Resource Managing Class
This video talks about an important resource management pitfall in C++ 03 (C++ 11 is not discussed here). When you class owns another object by its pointer, you should either: a) define deep copying for copy constructor and assignment operator; b) delete copy constructor and assignment operator, and use clone() function. As Klemens kindly pointed out: at 5:40, the accessor is not needed as it is accessed only by the same class.
|
|