C++Template学习

时间:2021-03-31 12:19:34   收藏:0   阅读:0
template<typename T>
void funcTmp(T a, T b)
{
    cout << "this is yiban" << endl;
}


template<>
void funcTmp(const char* a, const char* b)
{
    cout << "this is char*" << endl;
}


template<typename T>
class CTem 
{
public:
    void func()
    {
        cout << "this is usural func" << endl;

    }
};

void CTem<char>::func()
{
    cout << "this is char func" << endl;
}

template<>
class CTem<int>
{
public:
    void func()
    {
        cout << "this is int func" << endl;

    }
};

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!