[C++-sig] Inheritance with B/P

David Abrahams dave at boost-consulting.com
Fri Feb 7 18:41:49 CET 2003


Bruce Lowery <bruce_lowery at yahoo.com> writes:

> The short tutorial section on inheritance seems very clear.  However, the
> following doesn't work for me:
>
> struct Base {};
> struct Derived : Base {}
> struct SomeOther { void someFunc( Base* o ); }
>
> When wrapped (using bases<..> for Derived), the following gives a type error:
>
>> d = mod.Derived()
>> s = mod.SomeOther()
>> s.someOther( d )
> TypeError:  bad argument type for built-in operation
>>
>
> In reality, the wrappers "hold" Base and Derived using auto_ptr:
>
> class_< Base, auto_ptr<Base> >(...) ...;
> class_< Derived, auto_ptr<Derived>, bases<Base> >(...) ...;
>
> Any ideas?

This looks small enough that you could post a complete reproducible
test case, no?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list