阅读背景:

回忆C++知识点(1)

来源:互联网 

重载函数

#include <iostream>
using namespace std;
int Add(int x, int y) {//定义第一个重载函数
	cout << "int add" << endl;
	return x + y;
}
double Add(double x, double y) { //定义第二个重载函数
	cout << "double add" << endl;
	return x + y;
}
void main()
{
	int var = Add(5, 2);
	float fvar = Add(10.5, 11.4);
	
}#include <iostream>
using namespace std;



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: