1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/*通过重载函数调用运算符实现下列数学函数的抽象
f(x,y)=ax*x+by+c
*/
#include <iostream>
using
namespace
std;
class
Fun
{
public
:
int
operator()(
int
x,
int
y)
const
;
};
int
Fun::operator()(
int
x,
int
y)
const
{
int
a,b,c;
cin>>a>>b>>c;
return
a*x*x+b*y+c;
}
int
main()
{
Fun f;
cout<<f(2,3)<<endl;
system
(
"pause"
);
return
0;
}
|
(x,y)=ax*x+by+c 的抽象
最新推荐文章于 2019-02-27 18:02:00 发布