C++操作符重载

#include"iostream"
using namespace std;
class Number
{
	public:
		Number(int a ,int b)
		{
			this->a = a;
			this->b = b;
		}
		Number operator+(Number& n)
		{
			this->a = this->a + n.a;
			this->b = this->b + n.b;
			return *this;
		}
		Number& operator++(int)
		{
			this->a ++;
			this->b++;
			return *this;
		}
		friend void get(Number& n);
		Number& operator--()
		{
			this->a--;
			this->b--;
			return *this;
		}

	private:
		int a;
		int b;
};
void get(Number& n)
{
	cout<

你可能感兴趣的:(C语言)