//#include<iostream>
//#include<string>
//using namespace std;
//
//
//class MyInteger
//{
//public:
// MyInteger()
// {
// m_Num = 0;
// }
// //前置递增
// MyInteger& operator++()//返回引用是为了一直对一个数据进行操作
// {
// m_Num++;//先进性++运算
// return *this;//再将自身进行返回
// }
//
//public:
// int m_Num;
//};
//
//
//
后置递增
//
//ostream& operator<<(ostream& cout, MyInteger myint)
//{
// cout << myint.m_Num;
// return cout;
//}
//
//void test01()
//{
// MyInteger myint;
// cout << ++myint << endl;
//}
//
//int main()
//{
// test01();
//
// return 0;
//}
//#include<iostream>
//#include<string>
//using namespace std;
//
//
//class MyInteger
//{
//public:
// MyInteger()
// {
// m_Num = 10;
// }
// //前置递减
// MyInteger& operator--()//返回引用是为了一直对一个数据进行操作
// {
// m_Num--;//先进性--运算
// return *this;//再将自身进行返回
// }
//
//public:
// int m_Num;
//};
//
//
//
后置递减
//
//ostream& operator<<(ostream& cout, MyInteger myint)
//{
// cout << myint.m_Num;
// return cout;
//}
//
//void test01()
//{
// MyInteger myint;
// cout << --myint << endl;
//}
//
//int main()
//{
// test01();
//
// return 0;
//}
递增运算符重载
最新推荐文章于 2024-10-17 21:05:59 发布