////////////////////////////////// //abs.h ///////////////////////////////// #include < iostream >
using namespace std;
template <class T> class Base{ public: //T tvalue; ->error,'tvalue' uses undefined class 'T', why????? virtual T set_value(T tValue)=0; //defined 'tvalue' here is ok };
template <class X > class Son : public Base< class T >{ X s_value; public: X set_value(const Base<class T>& t){s_value=t;} };
///////////////////////////// //abs.cpp ////////////////////////////
#include "abs.h"
using namespace std; main() { Son<int> x; }
//two errors /* error C2259: 'Son<int>' : cannot instantiate abstract class due to following members: error C2259: 'Son<int>' : cannot instantiate abstract class due to following members: */