Question

I am trying to create a pure virtual base class (or simulated pure virtual)

my goal:

  1. User can't create instances of BaseClass.
  2. 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?

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top