How to setup the c++ rule of three in a virtual base class
- by Minion91
I am trying to create a pure virtual base class (or simulated pure virtual)
my goal:
User can't create instances of BaseClass.
Derived classes have to implement default constructor, copy constructor, copy assignment operator and destructor.
My attempt:
class Base
{
public:
virtual ~Base() {};
/* some pure virtual functions */
private:
Base() = default;
Base(const Base& base) = default;
Base& operator=(const Base& base) = default;
}
This gives some errors complaining that (for one) the copy constructor is private. But i don't want this mimicked constructor to be called.
Can anyone give me the correct construction to do this if this is at all possible?