[C++-sig] Casting from Base to Derived
Kelly Burkhart
kelly at kkcsm.net
Fri Mar 10 16:35:13 CET 2006
Greetings (and thanks for help on my last question!)
Given the following C++:
class Base {...};
class D1 : public Base {...};
class D2 : public Base {...};
struct Foo {
std::auto_ptr<Base> func(); // may return a D1 or D2
};
...
BOOST_PYTHON_MODULE(mod)
{
class_<Base>("Base", no_init);
class_<D1, bases<Base>() ...;
class_<D2, bases<Base>() ...;
}
How can I expose Foo so that Foo::func() returns a D1 or D2 rather than a
Base? What is the appropriate alternative to the C++ dynamic_cast?
Thanks,
-K
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060310/e23ecadd/attachment.htm>
More information about the Cplusplus-sig
mailing list