From: David Abrahams (dave_at_[hidden])
Date: 2003-03-24 07:24:38
Dave Gomboc <dave_at_[hidden]> writes:
>> > 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.)
You can do it, but then LSP doesn't matter since you know the concrete
>> 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
Can you clearly define the difference? I don't think I've ever read a
description of LSP which doesn't leave that question completely
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk