In the following code, class Uncopyable makes private any child class copy functions. I understand almost everything here except the destructor. Why should it be declared in Uncopyable? I've tried to comment it and everything works fine without it:
class Uncopyable {
protected: // allow construction
Uncopyable() {} // and destruction of
~Uncopyable() {} // derived objects...
private:
Uncopyable(const Uncopyable&); // ...but prevent copying
Uncopyable& operator=(const Uncopyable&);
};
To keep HomeForSale objects from being copied, all we have to do now
is inherit from Uncopyable:
class HomeForSale: private Uncopyable { // class no longer
... // declares copy ctor or
}; // copy assign. operator