J
jalina
Is the following ok ?
class Color {
private:
Color() {}
public:
static Color red;
static Color green;
static Color blue;
static Color orange;
};
bool operator==(const A& a1, const A& a2)
{
return &a1 == &a2;
}
Basically, I create some global objects (a new Color object can not be
instanciated) and since red, green, blue, orange are distinct, I think
they can be compared using their address.
Is that right ?
class Color {
private:
Color() {}
public:
static Color red;
static Color green;
static Color blue;
static Color orange;
};
bool operator==(const A& a1, const A& a2)
{
return &a1 == &a2;
}
Basically, I create some global objects (a new Color object can not be
instanciated) and since red, green, blue, orange are distinct, I think
they can be compared using their address.
Is that right ?