Hi!

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;
};


Adriano

------------------------------------------------------------------------------
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

Reply via email to