I have an LEDControl
class which sets the color of an LED using a method.
Many classes use this LEDControl
class to pass it some colors to assign to an LED. Therefore, I wanted to define the colors somewhere as a constant.
I thought I'd make a struct in my LEDControl
class called Color
, since I really only need to access the members directly and never anything else:
struct Color{
bool r;
bool g;
bool b;
};
I then added a #define in the .cpp
#define RED Color{true, false, false};
But this didn't work; it is not declared in the scope of any other class.
What can I do to store a set of colors somewhere in my program so that every class using the LEDControl
can use keywords or variable names like RED and GREEN?