I needed to check the parameter from the child's constructor before being sent to the parent. So far I've done this:
But that code didn't work. FYI, the parameters were unsigned chars so I needed to check whether the parameters can become negative or not. If it can, it will be inputed as zero in the parent class.
CListBox::CListBox(std::string name, SDL_Surface *screen, CTTFont* theFont,
Sint16 xx, Sint16 yy, Sint16 width,
Uint8 ROptColor, Uint8 GOptColor, Uint8 BOptColor, //option text color
Uint8 RColor, Uint8 GColor, Uint8 BColor, //button color
Uint8 RArrowColor, Uint8 GArrowColor, Uint8 BArrowColor) //arrow color
: CGUI_Object(name, screen, GUI_LISTBOX,
(RColor-0x33>RColor ? 0x00:RColor-0x33),(GColor-0x33>GColor ? 0x00:GColor-0x33),(BColor-0x33>BColor ? 0x00:BColor-0x33))
The question is it possible to include a logical expression in a parent's constructor? If it is, how do I do it?