RAD Studio |  |

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

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

Consider a test case with the following code:

Copy 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
    };

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!