自考新教材-p59_4(1)

源程序:

#include <iostream>
using namespace std;
class A
{
public:
int fun(double);
int fun(int);
};
int A::fun(double x)
{
return (int)x / 2;
}

int A::fun(int x)
{
return x * 2;
}
int main()
{
A a;
int s = a.fun(6.0) + a.fun(2);
cout << s << endl;
system("pause");
return 1;
}

运行结果:

 

posted @ 2020-02-06 14:10  bobo哥  阅读(131)  评论(0)    收藏  举报