c++ - passing a dummy int int the template argument -
this question has answer here:
recently got stuck in templates , passed dummy argument in template isn't working , gives compilation error here code..
#include <iostream> using namespace std; template<typename t> class a{ private: t b; public: a() { cout<<"1st executing "<<endl; } }; template<typename t,int> class a{ private: t b; public: a(){ cout<<"2nd executing "<<endl; } }; int main(){ a<string> a; a<string,100> b; }
in point of view should work fine gives re declaration error , dn't know why .....plz thanks
i'm not sure, think template <typename t = int>
Comments
Post a Comment