Header:
#ifndef ANIMATION_H
#define ANIMATION_H
struct Frame
{
int row;
int column;
Frame(int r, int c): row(r), column(c){}
Frame();
};
class Animation
{
public:
Animation();
Animation(int sr, int sc, int mxr, int mxc)
:frame(sr,sc),MAX(mxr,mxc),MIN(sr,sc){}
virtual ~Animation();
void nextFr();
int getRow();
int getCol();
bool operator> (const Frame& param);
protected:
private:
Frame frame;
Frame MAX;
Frame MIN;
};
#endif // ANIMATION_H
cpp:
int Animation::getRow()
{
return frame.row;
}
int Animation::getCol()
{
return frame.column;
}
void Animation::nextFr()
{
frame.column++;
if(frame.column > 9)
{
frame.column = 0;
frame.row++;
}
if(frame > MAX)
{
frame = MIN;
}
}
bool Animation::operator>(const Frame& param)
{
if(frame.row > param.row)
return true;
if(frame.row == param.row)
{
if(frame.column > param.column)
return true;
}
return false;
}
Everytime I try to compile, it gives me an error saying "cpp|32|error: no match for 'operator>' in '((Animation*)this)->Animation::frame > ((Animation*)this)->Animation::MAX'|". Now, what I think this error means is that it thinks that there is no operator ">" defined for the line "frame>MAX"(line 32). This is puzzling to me because I have both defined such an operator in the header and the cpp file right beneath function calling the line in question. Maybe there is something wrong with the way I have declared the operator overload?
Any help is appreciated. Thank you.