Easy/Dumb C++ Question
Posted: Sat Feb 16, 2008 7:42 pm
Consider the Following Class definition:
and then I use it like so...
Why is that correct instead of:
I am using a G++ cross compiler (elf output, os dev)
Thanks in advance,
Rich
Code: Select all
class Console
{
public:
enum Colors
{
BLACK = 0,
DARK_GREY = 8,
BLUE = 1,
LIGHT_BLUE = 9,
GREEN = 2,
LIGHT_GREEN = 10,
CYAN = 3,
LIGHT_CYAN = 11,
RED = 4,
LIGHT_RED = 12,
MAGENTA = 5,
LIGHT_MAGENTA = 13,
BROWN = 6,
LIGHT_BROWN = 14,
LIGHT_GREY = 7,
WHITE = 15
};
Console() { this->console_active = 0; }
//Init the console window... by default we need a size...
Console(u8int start_x, u8int start_y, u8int width, u8int height);
~Console();
//Sets the active Foreground Color
void set_forecolor(Colors fore_color);
//Sets the active Background Color
void set_bgcolor(Colors bg_color);
//Prints a string to the screen
void prints(const char *s);
void clear();
};
Code: Select all
Console term1;
void main()
{
term1.set_forecolor(Console::GREEN);
}
Code: Select all
term1.set_forecolor(Console::Colors::GREEN);
Thanks in advance,
Rich