Re: Efficiency of single inheritance
Davin Pearson wrote:
On Mar 1, 5:30 am, Markus Moll <markus.m...@esat.kuleuven.be> wrote:
Hi
Davin Pearson wrote:
I recently read a book that was cancelled from the University of
Canterbury library called: "Object Oriented Programming in Oberon-2"
by Hanspeter M\"ossenb\"ock. One sentence in this book that stands
out
for me is this one:
"Multiple inheritance also leads to less efficient code. For example
in C++ a method invocation causes additional runtime costs because of
the overhead involved with multiple inheritance --- even if the
program uses only single inheritance." (from page 109)
Care to explain? Otherwise it's just something that someone wrote in
some book.
Something that I accidentally omitted from my posting
is that Mossenbock cited the following reference
to justify his statement:
Stroustrup, B.: Multiple Inheritance for C++.
Proceedings EUUG Spring Conference, Helsinki,
May 1989.
There's a big difference between "I chose a 'sub-optimal' implementation
because it was more portable" and "in C++ a method invocation causes
additonal runtime costs ... even if the program uses only single
inheritance." The first is a statement about a particular implementation
(and remember, this was cfront, which generates C code, so portability
of the generated code was important) and the second is a general
statement about the language. Non sequitur.
--
-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]