C++类模板和模板类

类模板定义:

#include 
using namespace std;
template
class test
{
private:
  T n;
  const T i;
public:
    Test():i(0){}
    Test(T k);
     ~Test(){}

    void print();
    T operator+(T x);

}

template
void Test::print()
{
   cout<<"n = " <

你可能感兴趣的:(C++类模板和模板类)