Here is the way I have my base class working:
class AguiWidgetBase
{
//variables
AguiDockingEnum dockingStyle;
std::string text;
AguiRectangle clientRectangle;
AguiColor tintColor;
AguiColor fontColor;
std::map<int,int,CmpIntInt> children;
//private methods
void zeroMemory();
virtual void onPaint();
virtual void onAddChildControl(AguiWidgetBase *control);
virtual void onTintColorChanged(AguiColor color);
virtual void onDockingStyleChanged(AguiDockingEnum style);
virtual void onTextChanged(std::string text);
virtual void onThemeChanged(const AguiTheme &theme);
void (*onPaintCallback)(AguiRectangle clientRect);
void (*onTintColorChangedCallback)();
void (*onDockingStyleChangedCallback)();
void (*onTextChangedCallback)();
void (*onThemeChangedCallback)();
protected:
AguiWidgetBase *parentWidget;
public:
AguiWidgetBase(void);
~AguiWidgetBase(void);
void addChildControl(AguiWidgetBase *control);
void removeChildControl(AguiWidgetBase *control);
AguiWidgetBase* getParent();
void paint();
void setTintColor(AguiColor color);
AguiColor getTintColor();
void setDockingStyle(AguiDockingEnum style);
AguiDockingEnum getDockingStyle();
void setText(std::string text);
std::string getText();
void SetTheme( const AguiTheme &theme);
};
Some of them work like this. There is a regular non-overridable funcion which calls the virtual function and the function pointer if its not NULL.
Will my virtual functions be able to once again go into the private scope when I create derived classes or must they be public?
I want to avoid them being public due to my design.
Thanks
Virtual functions can have
public,protected, orprivateaccess.A discussion of them via the C++ FAQ.