E2462 'virtual' can only be used with non-template member functions (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

The 'virtual' keyword can only be applied to regular member functions, not to member template functions.

Consider a test case with the following code:

template <class T>
class myTemplateClass
{
  virtual int func1();                    // This is fine
  template <class T> virtual int func2(); // This causes an error
};
class myClass
{
  virtual int func1();                    // This is fine
  template <class T> virtual int func2(); // This causes an error
};