operator函数操作符

函数操作数()

可以实现将对象当函数使用。

1 class Square{
2 public:
3     double operator()(double x)const{return x*x;}    
4 };

 

posted @ 2019-07-23 14:05  Austin_anheqiao  阅读(265)  评论(0)    收藏  举报