c++ - Do virtual functions have to be public? -


here way have 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 this. there regular non-overridable funcion calls virtual function , function pointer if not null.

will virtual functions able once again go private scope when create derived classes or must public?

i want avoid them being public due design. thanks

virtual functions can have public, protected, or private access.

a discussion of them via c++ faq.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -