#include<iostream>
using namespace std;
class test{
public:
int ta, tb;
public: test(int a,int b){
ta = a;
tb = b;
}
void tprint(){
cout << ta << "+ test1" << endl;
cout << tb << "+ test2" << endl;
}
void operator()(){
ta++;
tb++;
}
};
int main(){
cout << "hello" << endl;
test tmp(3,4);
tmp.tprint();
tmp();
tmp.tprint();
return 0;
}
运行结果:
hello
3+ test1
4+ test2
4+ test1
5+ test2