|
Boost : |
From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2001-11-25 22:39:02
From: "Beman Dawes" <bdawes_at_[hidden]>
> At 07:32 AM 11/25/2001, John Maddock wrote:
> >Of course they all do the same thing, so we only need one of these - it
> >depends on which way you look at it I guess - personally I prefer
> >"is_public_base", as it's the easiest to understand what it does (I
> always
> >get "superclass" and "subclass" mixed up, and I'm sure I'm not alone!)
But it's easy. As you draw the inheritance hierarchy, superclasses come
above subclasses. That's how I remember it :o).
By the way, being a student has its perks - you learn lots of interesting
things. For example, I found out that Eiffel uses an inheritance scheme
(called covariant) that's conceptually unsound (you can get type errors at
runtime). This in spite of Eiffel's creator making a lot of arguments in
favopr of the practical advantages of that scheme. Java gets one (called
equivariant) that's correct (yet limited), except for arrays where it has to
carry out and check at runtime some type information. C++ implements an
equivariant scheme as well, plus covariant return types which are a bonus
because they are conceptually sound. Nobody in the class knew that C++
implements covariant return types - including faculty...
> Any number of otherwise intelligent people mix up "superclass" and
> "subclass", which aren't really usual C++ terms anyhow. OTOH,
> is_public_base uses familiar C++ terminology.
Yes, but is_public_base suffers of the "who's first and who's second"
problem. Per public demand, I changed super_subclass to base_derived. So
base_derived<T, U>::value is true is T is the base and U is the derived.
Andrei
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk