十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
#includeusing namespace std; class Square{ public: double operator()(double x)const{ return x * x; } int operator()(int a,int b,int c=0)const{ return a+b-c; } }; int main(void){ Square sq; //括号里面的参数会被自动当作形参传入 cout << sq(12) << endl; //144 cout << sq(1,5,3) << endl; //3 cout << sq(1,3) << endl; //4 return 0; }