1

Is it possible to define a virtual method on a class which has been specialized? For example

template
<class T_DataType>
struct Interface
{
T_DataType data;
...
};

struct NewInterface : Interface<int>
{
virtual
int return_data() = 0;
...
}

struct SubInterface : NewInterface
{
virtual
int return_data();
...
}

int SubInterface::return_data(){ return data;}
eaponte
  • 409
  • 5
  • 15

1 Answers1

1

Yes, the code is valid and works as intended.

And you don't specialize SubInterface in this case, you inherit it from template specialization.

CodeFuller
  • 30,317
  • 3
  • 63
  • 79