[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] Class inheritance
From:       Phil Thompson <phil () river-bank ! demon ! co ! uk>
Date:       2002-10-25 16:42:35
[Download RAW message or body]

On Friday 25 October 2002 5:17 pm, Sato, Kristine wrote:
> Hello,
>
> I am using SIP to wrap some of my own C++ classes.
>
> Given this class hierarchy,
>
> class ObBase
> {
> 	ObBase *GetParent();
> }
>
> case ObLevel1 : ObBase
> {
> }
>
>
> case ObLevel2 : ObLevel1
> {
> }
>
>
> When ObBase::GetParent() gets wrapped, it eventually calls
> 	return sipMapCppToSelf(res,sipClass_ObBase);
> However, the parent may in fact be an ObLevel1 or ObLevel2. How can I get
> SIP (or do I just need to write the code myself) to return the correct
> object type?

You need to write your own code, but if you use the %ConvertToSubClassCode 
directive then all the necessary conversions will be done automatically.

Have a look at how PyQt implements QEvent (in qevent.sip).

Phil

_______________________________________________
PyKDE mailing list    PyKDE@mats.gmd.de
http://mats.gmd.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic