Polymorphism of wxWindows

Milan Babuskov milanb at panonnet.net
Sun Sep 3 01:29:14 PDT 2006


63q2o4i02 at sneakemail.com wrote:
> remember the name of the function, but the compiler complained that the
> function was not a member of wxWindow

Perhaps because it really isn't a member function? Unless you say which 
function, there isn't much to help you with.

> Same thing for MyApp derived from wxApp... I tried accessing a member
> variable of MyApp with a wxApp* pointer that had been assigned to
> MyApp, and the compiler didn't like it.
> 
> Is this normal behavior or am I doing something wrong?

Both :)

wxApp doesn't have the method, so you can't call it. You should cast the 
pointer to appropriate type:

MyApp *myapp = dynamic_cast<MyApp *)(wxApp);
if (myapp)
	myapp->whaever();

-- 
Milan Babuskov
http://swoes.blogspot.com/
http://www.flamerobin.org





More information about the wx-users mailing list