123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
-
- #include <iostream>
- class MYPrint
- {
- public:
-
- void operator()(std::string test)
- {
- std::cout << test << std::endl;
- }
- };
- void MyPrint02(std::string test)
- {
- std::cout << test << std::endl;
- }
- void test01()
- {
- MYPrint myPrint;
- myPrint("Hello World");
- MyPrint02("hello world");
- }
- class MyAdd
- {
- public:
- int operator()(int num1,int num2)
- {
- return num1 + num2;
- }
- };
- void test02()
- {
- MyAdd myadd;
-
- int ret = myadd(100, 100);
- std::cout << "ret = " << ret << std::endl;
-
- std::cout << MyAdd()(100, 100) << std::endl;
- }
- int main()
- {
-
- test02();
- system("pause");
- return 0;
- }
|