[C++-sig] bases + wrapper bug?

Piotr Jaroszyński p.jaroszynski at gmail.com
Thu Aug 30 00:31:16 CEST 2007


On Saturday 18 of August 2007 19:54:55 Roman Yakovenko wrote:
> I will try to explain, how I understand this, but of course I could be
> wrong.
> (snip)
> At run time, behind PyObject you have holds DerivedWrapper class instance.
> During the first registration of "f", type of "this" pointer is
> BaseWrapper. I could be wrong, but the library doesn't scan for
> registered [pure] virtual functions and re-registers them again with
> the right "this" pointer.  So in your case: you call "f" with "this"
> pointer type "DerivedWrapper", than library does casting for you from
> DerivedWrapper to BaseWrapper and than it calls "f". Obviously this
> cannot work, becase BaseWrapper and DerivedWrapper are not base and
> derived classes.

Thanks a lot, you do seem to be right, but I still wonder whether it can be 
considered a bug or not. Would the re-registration introduce some unwanted 
behaviour if implemented?

-- 
Best Regards,
Piotr Jaroszyński



More information about the Cplusplus-sig mailing list