C++,类中重载函数的调用,类中模板函数定义与调用。

一、

include

include<stdio.h>

using namespace std;

class test
{
public:
test();
void func(int a)
{
printf("void func(int a)\n");
}
void func(char a)
{
printf("void func(char a)\n");
}
};

test::test()
{

}

class test1
{
public:
test1();
template void func(T a);
};

test1::test1()
{

}
template
void test1::func(T a)
{
printf("%d.",a)
}

int main()
{
int a = 5;
char b = 3;
test mytest;
mytest.func(a);
mytest.func(b);
return 0;
}

二、
https://www.cnblogs.com/hailong/articles/1977370.html

https://blog.csdn.net/u010921682/article/details/80805481

https://www.cnblogs.com/yongdaimi/p/9553098.html

https://bbs.csdn.net/topics/370128952

三、类模板与模板类
https://www.csdn.net/gather_23/Mtzacg4sNzQtYmxvZwO0O0OO0O0O.html

https://blog.csdn.net/HAHAandHEHE/article/details/80009894

posted @   hostid  阅读(703)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示