15.05.2016 00:59, Adriano dos Santos Fernandes wrote: > > Instead of write private copy constructor and operator=, what about > start using a mixing at least for new code? > > It makes easier and much more clear. > > Example taken from > http://ariya.ofilabs.com/2015/01/c-class-and-preventing-object-copy.html > > class NonCopyable > { > protected: > NonCopyable() {} > ~NonCopyable() {} > > private: > NonCopyable(const NonCopyable &); > NonCopyable& operator=(const NonCopyable &); > }; > > class Car : private NonCopyable { > public: > Car(): owner(0) {} > void setOwner(Person *o) { owner = o; } > Person *getOwner() const { return owner; } > private: > Person *owner; > };
Personally, I favor the former approach. I'm not against mixup classes in general, but rather prefer to use them for more complex solutions than just saving typing a couple of lines. Dmitry ------------------------------------------------------------------------------ Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel