请问成员函数模板为什么不可以是虚函数
class A
{
public:
template <class Type>
virtual Type min( Type a, Type b ) {
return a < b ? a : b;
}
};
int main() {
// ok: int min( int, int );
A aa;
aa.min(10,20);
//min( 10, 20 );
// ok: double min( double, double );
//min( 10.0, 20.0 );
return 0;
}
Compiling...
main.cpp
F:\AudioSwitchProject\TestFunctionTemplate\main.cpp(42) : error C2898: 'Type __thiscall A::min(Type,Type)' : member function templates cannot be virtual
Error executing cl.exe.