[PyKDE] SIP: wrapper code calls virtual functions with base class prefix

Tore Knabe tore_knabe at yahoo.de
Tue Jul 8 13:51:01 BST 2003


Hi,

I want to wrap a base class, which serves as an
interface, and inherit from this base class in C++.
The C++ class, which is not wrapped, overrides the
virtual function foo() from the base class. My
problem: when I call a factory method in Python to
create an object obj of the derived class, then
calling obj.foo() in Python executes the code from the
base class, not the derived one. Looking at the
wrapper code generated by SIP shows that foo is called
with the base class scope: BaseClass::foo(). This code
is generated by the function generateFunctionCall in
the SIP source file gencode.C. The commentary to the
function says:

"... call the real function and not any version in the
wrapper class in case it is virtual.  This will
prevent virtual loops."

This protection against virtual loops prevents me from
using an interface class the way I planned. What would
happen if it were removed? What is an example of a
virtual loop?

Tore

__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Logos und Klingeltöne fürs Handy bei http://sms.yahoo.de




More information about the PyQt mailing list