Re: Newbie OOP question

From: Jerry Coffin (jcoffin_at_taeus.com)
Date: 05/05/04


Date: 5 May 2004 09:00:28 -0700


"David White" <no@email.provided> wrote in message news:<atXlc.15153$KS1.314792@nasal.pacific.net.au>...

[ ... ]

> Well, I don't know how you can come up with the name CollectionOfBook
> without thinking of the object as a collection of books, however long you
> think of it.

Yes, I've already gone on record as stating that the name involved was
poorly chosen. The only question that's left is whether this section
was ever, in the slightest way at any time intended as a tutorial.
There's not really much room for question about that either: it
clearly was not!

[ ... ]

> It says: "As described in "Multiple Inheritance" on page 264, a class can be
> derived from more than one base class. In a multiple-inheritance model
> (where classes are derived from more than one base class)..."
> The writer felt the need to say twice that a class can be derived from more
> than one base class, and that's not counting page 264. Pretty basic stuff
> spelled out three times.

At the time this was NOT basic stuff -- multiple inheritance was quite
new, and nearly unique to C++ at that. It simply did not exist in
most previously well-known OO languages like Smalltalk and Simula.

The fact of the matter is that it has a minimal description of what
multiple inheritance IS, and then launches into a discussion of the
precise syntax used, and the order of construction and destruction.

[ ... ]

> No, but the C++ standard defines the entire language, and cannot assume that
> the reader knows anything at all about C++. If such examples are needed or
> helpful, then their presence is appropriate.

...which was exactly the case here as well. Remember that this was
publshed in early 1991. _The C++ Programming Language_ (first
edition) had been published, but described a language with only single
inheritance (among other things). The ARM hadn't been published yet,
but even if it had, it described a language that inclduded (a
primordial form of) templates. Neither was anywhere close to an
accurate description of the language they accepted. As such, MS had
little choice but to write some sort of manual describing the language
their compiler accepted.

This was also the first C++ compiler MS had ever published. As such,
they had little choice to to write their manuals based on the
assumption that the user had no familiarity with C++. Even if they
assumed familiarity with C++, multiple inheritance was a new feature
at the time anyway -- for comparison, consider this summary from
mid-1990:

http://www.google.com/groups?selm=3239%40se-sd.SanDiego.NCR.COM

Note in particular that at that time, support for multiple inheritance
was NOT universal at all.

[ ... ]

> Not possible. CollectibleString objects cannot be stored in a collection in
> which the element type is Collectible.

Well, of course we're all aware of slicing -- I was attempting to
present the situation without getting sidetracked into a 500 page
thesis about the problems inherent in writing collections in a nearly
15 year-old version of C++. Since we're all well aware of the details
anyway, it seemed (and still seems) quite pointless to go into lots of
details about it.

[ ... ]

> > A lot of people tried to come up with ways of making collections work
> > well within the language as it was defined at the time. If anybody
> > did a job that was much better than the example given, I (for one) am
> > unaware of its existence.
>
> Void pointers.

I see. Presumably, you also advocate curing a hangnail by amputating
the arm at the shoulder?

In case that wasn't clear: IMO, your proposed "improvement" is
drastically worse than the disease it purports to cure.

--
    Later,
    Jerry.
The universe is a figment of its own imagination.


Relevant Pages

  • Re: Strategic Functional Migration and Multiple Inheritance
    ... an EVIL FACADE to force us to live without MULTIPLE INHERITANCE. ... and 'senior' level programmers in the non-C++ programming communities. ... We wanted to post this question in several language communities prior ... I wanted to query the C# community (the 'target' ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: CLOS Properties Question
    ... >> designers' incapability of getting multiple inheritance right. ... >> Lisp is indeed much better in terms of conceptual language neutrality. ... field declarations have a more "declarative" feel. ... reasonable design for proper multiple inheritance. ...
    (comp.lang.lisp)
  • Re: OO paradigm in practice
    ... Ada2005, but my question applies to all other language with similar semantics: single inheritance, single dispatch and a limited form of multiple inheritance with Java-like interfaces. ...
    (rec.games.roguelike.development)
  • Re: [OT] Java, C#: why no multiple inheritance?
    ... crichmon wrote: ... > languages don't allow multiple inheritance? ... transparency like Java, ... Enjoy a language that supports it. ...
    (comp.lang.cpp)
  • [OT] Java, C#: why no multiple inheritance?
    ... The main language that I progam in is C++. ... languages don't allow multiple inheritance? ... re-design my objects if I ever convert C++ code to C# or Java. ...
    (comp.lang.cpp)