operator function overloads
using this class im trying to implement functions prototypes
here:
class Length
{
public:
Length ();
~Length ();
void setLength (int yards, int feet, int inches);
int getYards();
int getFeet();
int getInches();
private:
int m_yards;
int m_feet;
int m_inches;
};
there is the class and here is the function prototypes
Length operator+(length right);
Length operator= (lenght right);
Length operator>(lenght right);
Length operator< (lenght right);
and all i need is to implement the function prototypes:
this is what i tryed but failed maybe you guys can see my mistakes------
Length Length::operator+ (Length right);
{
int answers;
answers = m_yards + m_feet + m_inches
return Length(answer);
}
Length &Length::operator= (Length right);
{
if(this !& right)
{
setLength(right.m_yards, right.m_feet, right.m_inches);
}
return *this;
}
bool Length::operator>(length right)
{
if (getyards () >right.getyards())
return true;
else
return false;
}
{ if (getfeet() > right.getfeet());
return true;
else
return false;
}
{ if (getinches () > right.getinches());
return true;
else
return false;
}
bool Length:: operator< (Lengths right)
{
if ( getyards () < right.getyards());
return true;
else
return false;
}
{ if (getfeet () < right.getfeet());
return true;
else
return false;
}
{ if (getinches() < right.getinches());
return true;
else
return false;
}
//thats all i have so far and its not right so im looking for any input to the solution of this problem i hope i supplied you people with enought info to figure out what im doing..