#include<iostream>
#include<math.h>
#include<string>
using namespace std;
class Person
{
public:
int operator()(int v1,int v2){
return v1 + v2;
}
};
void test01() {
Person person;
cout << person(10, 10) << endl;
}
class Person1
{
public:
Person1() {
this->count = 0;
}
void operator()(string test) {
cout << test << endl;
this->count++;
}
int count = 0;
};
void doPrint(Person1 person3,string test) {
person3(test);
}
void test02() {
Person1 person1;
person1("hello");
person1("hello");
person1("hello");
person1("hello");
cout << person1.count << endl;
}
void test03() {
Person1 person12;
doPrint(person12,"hello");
}
int main() {
test03();
system("pause");
return 0;
};
|