class Complex{
public:
int Add(int x,int y){
return x + y;
}
int operator()(int x,int y){
return x + y;
}
};
void test01(){
Complex complex;
cout << complex.Add(10,20) << endl;
//对象当做函数来调用
cout << complex(10, 20) << endl;
}
38 C++ - 函数调用符号()重载
原创
©著作权归作者所有:来自51CTO博客作者阿甘兄_的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
C++入门-命名空间、引用、函数重载
C++入门知识,包括命名空间,引用,函数重载等。
命名空间 函数重载 传引用 C++ -
C/C++函数重载
为什么C语言不支持函数重载编译器在编译.c文件时,只会给函数进行简单的命名。具体方
c++ 编译器 函数重载 符号表