这是一个模板类。有两个数据成员first,second。有两个构造函数。从构造函数1来看,_T1,_T2具现时是两个类。如果不是类,请调用构造函数2,当然是类也可以调用它。

解决方案 »

  1.   

    只要把_T1和_T2分别换成 int 和 float就好理解了
    其实就是定义了一个类(这里是个结构)
    只不过它的成员类型还不确定,
    当你在程序中象这样定义:
    CPair<int,float> myPair
    那么类CPair的成员类型就确定了
      

  2.   

    给个展开就明白了。CPair <CPoint, CRect> tmp;
    展开为:
    class 
    {
     typedef CPoint first_type;
      typedef CRect second_type;   CPoint first;
      CRect second;
      CPair() : first(CPoint()), second(CRect()) {}
      CPair(const CPoint& __a, const CRect& __b) : first(__a), second(__b) {}
    }tmp;
      

  3.   

    typedef _T1 first_type;
     typedef _T2 second_type;这两行有什么用呢??
      

  4.   

    my teacher told me that if i don't know what is 'template structure' i should read the book 'C++ primer'
      

  5.   

    to ActiveLF(程序人生) where is 'C++ primer'??
      

  6.   

    可以用 first_type , second_type 来代替 _T1, _T2._T1 first;
    _T2 second;  可以用以下代替:
    first_type first;
    second_type second;
          
      

  7.   

    visit the link belowhttp://www.guxiang.com/epubcn/TempFolder/cpp_primer_3rd.zipand the decode password iswww.epubcn.com