quiz - RawIron/learn-cpp GitHub Wiki

static variable in a virtual method

class Widget {
  public:
    virtual const std::string & className() const {
        static const std::string name{"Widget"};
        return name;
    }

protected constructor

  • it is not possible to create an instance of the class
  • class can only be used for subclassing
class Widget {
  protected:
    Widget()
    {
    }

public virtual inheritance

class Widget : public virtual WidgetBase
{