/*
Name: 模板函数Demo
Copyright:
Author:
Date: 22-09-11 21:10
Description:
*/
#include<iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
template<typename T>void myFunc1(T x,T y){
std::cout<<"before:x===="<<x<<"\n"<<"y=="<<y<<endl;
x= y;
cout<<"after:x===="<<x<<endl<<"y=="<<y<<endl;
}
int main()
{
int i=0;
int j=0;
myFunc1(i,j);
char a='a';
char b='b';
myFunc1(a,b);
system("pause");
return 0;
}
模板使用之模板函数Demo
最新推荐文章于 2021-03-01 01:48:13 发布