here is my code for a .cpp of a header file. My question is: is there another way to write this than using "this" pointer?
Code:
#include "Integer.h"
Integer::Integer() //once Integer object is made it will be initialized to 0
{
this->number=0;
}
Integer::Integer(int num) //once an Integer object is made it will be initialized to num
{
this->number=num;
}
Integer::~Integer()
{
//nothing
}
int Integer::getInt()
{
return this->number;
}
bool Integer::operator<(Integer i) // overload < operator
{
if(this->number<i.number)
return true;
else
return false;
}
bool Integer::operator>(Integer i) //overload > operator
{
if(this->number>i.number)
return true;
else
return false;
}
int Integer::operator++() //overload ++ operator
{
return this->number++;
}
int Integer::operator--() //overload -- operator
{
return this->number--;
}
just editited my code...this is the correct one