class which cannot be derived

Posted by benjamin button on Stack Overflow See other posts from Stack Overflow or by benjamin button
Published on 2010-04-14T12:36:51Z Indexed on 2010/04/14 12:43 UTC
Read the original article Hit count: 201

Filed under:

I found this code here

class Usable;

class Usable_lock {
    friend class Usable;
private:
    Usable_lock() {}
    Usable_lock(const Usable_lock&) {}
};

class Usable : public virtual Usable_lock {
    // ...
public:
    Usable();
    Usable(char*);
    // ...
};

Usable a;

class DD : public Usable { };

DD dd;  // error: DD::DD() cannot access
        // Usable_lock::Usable_lock(): private  member

Could anybody explain me this code?

© Stack Overflow or respective owner

Related posts about c++