All I have to do is declare the overloaded assignment operator, and copy constructor, as private, correct? |
|
|
By default, a class has 5 operations: copy assignment copy constructor move assignment move constructor destructor If you declare any of those you must consider all and explicitly define or default the ones you want. Think of copying, moving, and destruction as closely related operations, rather than individual operations that you can freely mix and match - you can specify arbitrary combinations, but only a few combinations make sense semantically. If any move, copy, or destructor is explicitly specified (declared, defined, =default, or =delete) by the user, no move is generated by default. If any move, copy, or destructor is explicitly specified (declared, defined, =default, or =delete) by the user, any undeclared copy operations are generated by default, but this is deprecated, so don't rely on that. ... I strongly recommend that if you declare one of these five function, you explicitly declare all. - Stroustrup http://www.stroustrup.com/C++11FAQ.html#default2 |