I know this is a pretty basic C++ question, but I've just started learning to use wxWidgets and am a little confused about the inheritance aspect of the OnInit function in most examples.
I understand that OnInit is a wxApp function and a virtual one, which needs to be overridden in order to start an application. It's my understanding that when a function is to be overridden it is declared in the base class as virtual, but when actually being overridden is declared as normal (ie without the virtual). However in all the wxWidgets examples I see, when the class that inherits from wxApp is being declared, they still declare OnInit as virtual, although then the implementation of that class is as normal. Eg:
Code: Select all
class MyApp : public wxApp{
public:
virtual bool OnInit(); //why not just "bool OnInit();"?
};
bool MyApp::OnInit(){
//stuff
}
Thanks,
satch