Boost logo

Boost :

From: alust_at_[hidden]
Date: 2001-03-27 00:29:58


Hi!

I have following class hierarchy in C++:

struct b {virtual int m()=0;};
struct d0: b {virtual int m();};
struct d1: b {virtual int m();};

Also I have a factory function which is declared as returning objects
of class b, but really it makes objects of either class d0 or d1:

b &f();

When I call f() through BPL in python the returned object is treated
as object of class b, but at run-time I can determine to which derived
class the object really belongs.

So is it possible in python to cast an object obtained from a BPL
module from the base class to a derived one? This is necessary for
pickling.

Thanks,
Alexei


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk