12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- #if(0)
- #include <iostream>
- class MyInteger
- {
- friend std::ostream& operator<<(std::ostream& cout, MyInteger myint);
- public:
- MyInteger()
- {
- m_Num = 0;
- }
-
- MyInteger& operator++()
- {
-
- m_Num++;
-
- return *this;
- }
-
-
- MyInteger operator++(int)
- {
-
- MyInteger temp = *this;
-
- m_Num++;
-
- return temp;
- }
- private:
- int m_Num;
- };
- std::ostream& operator<<(std::ostream&cout , MyInteger myint)
- {
- std::cout << myint.m_Num;
- return cout;
- }
- void test01()
- {
- MyInteger myint;
- std::cout << ++(++myint) << std::endl;
- std::cout << myint << std::endl;
- }
- void test02()
- {
- MyInteger myint;
- std::cout << myint++ << std::endl;
- std::cout << myint << std::endl;
- }
- int main()
- {
-
- test02();
-
-
-
- system("pause");
- return 0;
- }
- #endif
|