I've a compilation error.
I've tried this:
#ifndef RUTA_H
#define RUTA_H
#include <QtCore>
class Ruta
{
public:
Ruta();
void setNum(int r);
int getNum();
bool operator==(Ruta *one, Ruta *two)
{
return one->num==two->num;
}
private:
int num;
};
#endif // RUTA_H
#ifndef RUTA_H
#define RUTA_H
#include <QtCore>
class Ruta
{
public:
Ruta();
void setNum(int r);
int getNum();
bool operator==(Ruta *one, Ruta *two)
{
return one->num==two->num;
}
private:
int num;
};
#endif // RUTA_H
To copy to clipboard, switch view to plain text mode
I got this error:
D:/ruta.h:38: error: `bool Ruta::operator==(Ruta*, Ruta*)' must take exactly one argument
D:/ruta.h:38: error: `bool Ruta::operator==(Ruta*, Ruta*)' must take exactly one argument
To copy to clipboard, switch view to plain text mode
And then I've tried this:
#ifndef RUTA_H
#define RUTA_H
#include <QtCore>
class Ruta
{
public:
Ruta();
void setNum(int r);
int getNum();
private:
int num;
};
bool operator==(Ruta *one, Ruta *two)
{
return one->getNum() == two->getNum();
}
#endif // RUTA_H
#ifndef RUTA_H
#define RUTA_H
#include <QtCore>
class Ruta
{
public:
Ruta();
void setNum(int r);
int getNum();
private:
int num;
};
bool operator==(Ruta *one, Ruta *two)
{
return one->getNum() == two->getNum();
}
#endif // RUTA_H
To copy to clipboard, switch view to plain text mode
i've another error:
D:/ruta.h:43: error: `bool operator==(Ruta*, Ruta*)' must have an argument of class or enumerated type
D:/ruta.h:43: error: `bool operator==(Ruta*, Ruta*)' must have an argument of class or enumerated type
To copy to clipboard, switch view to plain text mode
Thanks!
Bookmarks