Boost logo

Boost :

From: Dave Gomboc (dave_at_[hidden])
Date: 2003-03-24 00:00:53


> > Since you advocate elsewhere that exception classes be derived
> > from std::exception, the answer is because otherwise LSP would
> > be violated.
>
> You can't access the derived class' assignment operator through a
> pointer/reference to a polymorphic base, so that point is moot.

Well, you're the expert on this. (I thought you could catch a reference
to an exception, dynamic_cast it downwards, then use the assignment
operator. Sure, this would be a stupid thing to do, but if possible I
certainly can imagine some few misguided souls who haven't yet grokked C++
exception handling doing so.)

> LSP is weird anyway. What's the point of polymorphism if you're not
> going to change the behavior of the class in some observable way? If
> the derived class were transparently substitutable for the base class
> it wouldn't be much good, would it?

I disagree here; "transparently substitutable" != "observable behaviour is
identical".

Dave


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