[C++-sig] wrapping virtual function returning void

Eric Jardim ericjardim at gmail.com
Sun Aug 7 14:52:02 CEST 2005


2005/8/6, Faheem Mitha <faheem at email.unc.edu>:
> 
> That's interesting. So, for pure virtual functions, it would look like the
> version below?


Sure! 


I don't understand what this wrapper is doing, so that makes it more
> difficult for me to make these deductions.


The wrapper<...> is doing goog things. Before the existence of wrapper<...>, 
when someone wanted to create derived wrapper class, they should expose a 
"PyObject* self" (which is a low-level pointer for the
Boost.Pythonhigh-level users) as the first argument of every
constructor.

Now, with wrapper<...>, it is incapsulating the "PyObject* self" and you 
don't even have to know it exists. Besides, it creates this get_override 
function, that helps you if an virtual method was overriden in Python.


According to the documentation, it overrides the base class in Python. I
> assume this is related to the derived class wrappers in Python knowing of
> their derived relationship to the base class wrapper, but I'm pretty fuzzy
> on the details.


That's the good point of the incapsulation. While it works, you don't have 
to care about the details :)

[Eric Jardim]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20050807/9d4d58d0/attachment.htm>


More information about the Cplusplus-sig mailing list