[C++-sig] Pyste bug: protected virtual methods
Nicodemus
nicodemus at esss.com.br
Mon Oct 27 20:58:40 CET 2003
Niall Douglas wrote:
>Ok, there's FXWindow which provides a virtual method GetClass() but
>it's protected so pyste doesn't wrap it in the definition for
>FXWindow.
>
>However, FXMainWindow inherits off FXWindow and in
>FXMainWindow_Wrapper there's an override for GetClass()! Needless to
>say, because python doesn't know of GetClass it can't call the
>default method :(
>
>Solution: Don't generate items in X_Wrapper unless they're public.
>This is overkill however, because technically protected methods
>should be available to python if a python class inherits off it.
>
Another solution would be to expose the protected members, but that
would make them public in Python. I think this solution is more
flexible, since the purpose of a protected method is to allow subclasses
to call it... and the user can always rename the methods to prepend an
"_", following Python's convention. What do you think?
Regards,
Nicodemus.
More information about the Cplusplus-sig
mailing list