declaring member functions private and deliberately not implementing them
class HomeForSale {
public:
...
private:
...
HomeForSale(const HomeForSale&);
HomeForSale& operator=(const HomeForSale&);
};
declaring the copy constructor and copy assignment operator private not in HomeForSale itself, but in a base class
class Uncopyable {
protected:
Uncopyable() {}
~Uncopyable() {}
private:
Uncopyable(const Uncopyable&);
Uncopyable& operator=(const Uncopyable&);
};
class HomeForSale: private Uncopyable {
...
};
Uncopyable is not designed to allow the manipulation of derived class objects via base class interfaces. As a result, they do not need virtual destructor.