CArray<int ,int>&r 的理解

CArray是个模板类,其中成员变量、函数可用到模板形参表中的任一类型
template<class FirstType, class SecondType>
class CArray
{
public:
    FirType elem1;
    SecType elem2;
};
则声明CArray<int,int>就相当于
class CArray
{
public:
    int elem1;
    int elem2;
};
CArray<int,int>&r就是一个CArray类型变量的引用
posted @ 2022-03-14 09:47  伊红美兰  阅读(138)  评论(0)    收藏  举报