Override number of parameters of pure virtual functions

Posted by Jir on Stack Overflow See other posts from Stack Overflow or by Jir
Published on 2010-05-27T08:35:42Z Indexed on 2010/05/27 8:41 UTC
Read the original article Hit count: 366

Filed under:
|
|
|

I have implemented the following interface:

template <typename T>
class Variable
{
public:
  Variable (T v) : m_value (v) {}
  virtual void Callback () = 0;
private:
  T m_value;
};

A proper derived class would be defined like this:

class Derived : public Variable<int>
{
public:
  Derived (int v) : Variable<int> (v) {}
  void Callback () {}
};

However, I would like to derive classes where Callback accepts different parameters (eg: void Callback (int a, int b)). Is there a way to do it?

© Stack Overflow or respective owner

Related posts about c++

Related posts about interface