c++,函数调用运算符重载

c++,函数调用运算符重载,第1张

#include
#include
using namespace std;
#include
#include
class My
{
public:
    void operator()(string test)
    {
        cout<     }
};
class Myadd
{
public:
    int operator()(int num1,int num2)//匿名对象
    {
        return num1+num2;
    }
};
void test02()
{
    Myadd myadd;
    myadd(100,100);
    int ret=myadd(100,100);
    cout<     cout< }
void test01()
{
    My my;
    my("hello ");

}
int main()
{
    //test01();
    test02();


    system("pause");
    return 0;
}
 

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/662361.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-04-18
下一篇2022-04-18

发表评论

登录后才能评论

评论列表(0条)

    保存