Efe Balo
Efe Balo

Reputation: 3

override an interface method containing ellipsis with an universal reference in c++

I would like to override an interface method which contains an ellipsis with a template method. I wonder if this is possible.

Imagine following:

class MyInterface
{
  public:
  virtual void myMethod(int i, const char* fmt, ...) = 0;
};

class MyMock: public MyInterface
{
  template< typename ...Args >
  void myMethod(int i, const char* fmt, Args&&... args) override
  {
    //use ellipsis expressions here

  }
};

When I do this I get the following error:

C++ function modifier (override) does not apply to member template declaration

Upvotes: 0

Views: 65

Answers (0)

Related Questions