Polymorphism of wxWindows
Vadim Zeitlin
vadim at wxwindows.org
Sat Sep 2 15:49:35 PDT 2006
On 2 Sep 2006 13:50:43 -0700 63q2o4i02 at sneakemail.com wrote:
> Hi, I was trying to access a member function of a wxPanel by using a
> wxWindow* pointer that had been assigned to a wxPanel. I don't
> remember the name of the function,
... but it wasn't a virtual one. Polymorphism only works for virtual
functions in C++.
> 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?
Yes, this is normal behaviour. Use wxGetApp() to retrieve the app object
of the "correct" type (and see also DECLARE_APP() macro).
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
More information about the wx-users
mailing list