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

原文链接: https://www.cnblogs.com/retry/p/11130657.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

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

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/298234

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月15日 下午7:23
下一篇 2023年2月15日 下午7:23

相关推荐