Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2004-08-23 15:56:33


Stephen torri <storri_at_[hidden]> writes:

> On Mon, 2004-08-23 at 15:04, Jonathan Turkanis wrote:
>> > 1) Use virutal inheritance. I see the example and can understand
>> why
>> > its wrong I just do not understand how to fix it.
>>
>> I believe in the example the fix is to use virtual inheritance in the
>> definitions of my_exc1 and my_exc2, so that later someone can derive
>> from both. Using virtual inheritance in the definition of your_exc3
>> doen't help. I see that this advice is not followed consistently
>> within boost (Robert Ramey's serialization library is the only case I
>> can find). But it's still good advice, I think.
>
> To do virtual inheritance I was under the belief that the base class had
> only pure virtual methods. Each subclass then implements the virtual
> methods. Is this what was intended or am I misunderstanding the term
> virtual inheritance?

It has nothing to do with virtual functions.

   struct my_exception : virtual std::exception
                         ^^^^^^^
   {
       // ...
   };

HTH,

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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