#include "Cnumber.h"
Cnumber::Cnumber()
{
m_nNumber = 0;
}
Cnumber::Cnumber(int n)
{
m_nNumber = n;
}
Cnumber operator+(int n, const Cnumber& num)
{
return num.m_nNumber + n;
}
//--------------------------------------------------------------
Cnumber Cnumber::operator+(Cnumber num)
{
Cnumber result;
result.m_nNumber = this->m_nNumber + num.m_nNumber;
return result;
}
Cnumber Cnumber::operator-(Cnumber num)
{
Cnumber result;
result.m_nNumber = this->m_nNumber - num.m_nNumber;
return result;
}
Cnumber Cnumber::operator*(Cnumber num)
{
Cnumber result;
result.m_nNumber = this->m_nNumber * num.m_nNumber;
return result;
}
Cnumber Cnumber::operator/(Cnumber num)
{
Cnumber result;
result.m_nNumber = this->m_nNumber / num.m_nNumber;
return result;
}
//--------------------------------------------------------------
Cnumber Cnumber::operator=(const Cnumber& num)
{
this->m_nNumber = num.m_nNumber;
return *this;
}
//--------------------------------------------------------------
bool Cnumber::operator==(const Cnumber& num)
{
return this->m_nNumber == num.m_nNumber;
}
bool Cnumber::operator!=(const Cnumber& num)
{
return this->m_nNumber != num.m_nNumber;
}
bool Cnumber::operator<(const Cnumber& num)
{
return this->m_nNumber < num.m_nNumber;
}
bool Cnumber::operator>(const Cnumber& num)
{
return this->m_nNumber > num.m_nNumber;
}
bool Cnumber::operator<=(const Cnumber& num)
{
return this->m_nNumber <= num.m_nNumber;
}
bool Cnumber::operator>=(const Cnumber& num)
{
return this->m_nNumber >= num.m_nNumber;
}
//--------------------------------------------------------------
Cnumber Cnumber::operator++()
{
return this->m_nNumber++;
}
Cnumber Cnumber::operator--()
{
return this->m_nNumber--;
}
//--------------------------------------------------------------
Cnumber Cnumber::operator+=(const Cnumber& num)
{
return this->m_nNumber += num.m_nNumber;
}
Cnumber Cnumber::operator-=(const Cnumber& num)
{
return this->m_nNumber -= num.m_nNumber;
}
Cnumber Cnumber::operator*=(const Cnumber& num)
{
return this->m_nNumber *= num.m_nNumber;
}
Cnumber Cnumber::operator/=(const Cnumber& num)
{
return this->m_nNumber /= num.m_nNumber;
}
//--------------------------------------------------------------
void Cnumber::Print()
{
cout << m_nNumber << endl;
}
Cnumber::~Cnumber()
{
}