Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::bind with derivated class
From: Igor R (boost.lists_at_[hidden])
Date: 2011-09-24 12:08:55


> myclass::mythreadmethod( const mysuperclass myobj ) {} // I need a copy of the object, so I don't set the reference operator &
> mysuperclass is a pure virtual class. Now I create a derivate class with
> class myderivate : public mysuperclass {}
> and call
> myderivate y;
> myclass x;
> x.mymethod( y );
> The compiler breaks with the error, that myobj is a class with pure virtual methods. How I can call the bind methods with the correct object?
> myobj is an object of the derivated class

No, it isn't of the derived class, it's an instance of the abstract base.
When you pass an object by value, it gets "sliced". It's unrelated to
Boost.Bind, it's just c++ rule.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net