From 1861805579862092637
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fdf5ec91b4c47347
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-02-03 22:43:29 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!newsswitch.lcs.mit.edu!newspump.monmouth.com!newspeer.monmouth.com!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: allan_w@my-dejanews.com (Allan W)
Newsgroups: comp.std.c++
Subject: Re: Some features to be added to class-based OO languages
Date: Tue, 4 Feb 2003 06:43:26 +0000 (UTC)
Organization: http://groups.google.com/
Lines: 59
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <7f2735a5.0302031617.31c35622@posting.google.com>
References: <59143289.0301280527.1e95174d@posting.google.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: mail2news.demon.co.uk 1044341007 16258 10.0.0.1 (4 Feb 2003 06:43:27 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Tue, 4 Feb 2003 06:43:27 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.05)
	id 18fwnj-0004E5-00
	for mail2news@news.news.demon.net; Tue, 04 Feb 2003 06:43:23 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id RAA10950; Tue, 4 Feb 2003 17:43:19 +1100 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ncar.ucar.edu
X-Newsgroups: comp.std.c++
X-NNTP-Posting-Date: 4 Feb 2003 00:18:00 GMT
X-MailScanner: PASSED (v1.2.7 12008 h140I0GS022467 mailbox4.ucsd.edu)
X-Spam-Status: No, hits=-9.7 required=5.0
	tests=NOSPAM_INC,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_02_03
	version=2.41
Xref: archiver1.google.com comp.std.c++:17768

o.v@k.ro (O.V.) wrote

> 1. Dynamic inheritance
> 
> The major drawback of the classical inheritance scheme are the
> limitations in combining different types (classes) on the same object.
> Letting an object of class A be also of class B and C can be
> difficult, especially when B and C are subclasses of A. This is not
> easily accomplished even with multiple inheritance.
> Dynamic inheritance solves this by allowing the base object of a
> derived object to be chosen explicitly in the client function.
> 
> Dynamic inheritance is provided in some languages, but it is said to
> be difficult or even impossible to support in class-based languages.
> It is also said to be unsafe, which may be true, but in my view the
> benefits are substantial enough to be worth having it. As for the
> implementation difficulties, I may be wrong but I really don't think
> so. I will therefore give a brief description of what I have in mind;
> it may be a somewhat limited version but provides in my opinion most
> of the benefits of the full scheme. And it's doable; in fact the
> interface-based approach can be implemented with some small effort in
> today's C++.

Would you please reword this? Assume that most of your audience is
like me: almost all of my OO experience comes from C++, so any
proposal to change the OO foundation in C++ is going to seem as if
it was no longer OO, even if it really is more so. If you lived
your whole life in the African desert, and then someone showed you
an ice cube and said, "this is water," you would have trouble
seeing it -- that's probably similar to why I can't understand your
point here.

In particular, I've spent many years modeling data to fit well
with the concept of C++'s classes. A Hyundai is-a car is-a vehicle
is-a machine, and so on. It seems like you want to allow some
functions to allow that a Hyundai is-a duck, even though that isn't
true anywhere else in the program. In my experience it would make
more sense to create a Hyundai_Duck class, either with multiple
inheritance or with a contained duck. Obviously what you have in
mind is something different; you want to (temporarily?) look at
Hyundai and (without changing the data?) consider it as a type
of duck. Is that close?

I'd like to see some (hopefully simple) example of how this would
be used and why it would be an advantage.

For now, don't focus on HOW the compiler would do this, unless it's
neccesary in order to understand WHAT it is doing. Focus instead
please on what it means to "let an object of class A also be of
class B and C" in some way other than inheritance.

Thanks.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



