From -494424889340082816
X-Google-Thread: f78e5,33c1ffa960d55699
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news3.google.com!news2.google.com!proxad.net!newsfeed.stueberl.de!feed.news.tiscali.de!newsfeed.icl.net!newsfeed.fjserv.net!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: house@usq.edu.au (Ron House)
Newsgroups: comp.std.c++
Subject: Re: Suggestion: parent
Date: Wed, 11 May 2005 20:58:41 GMT
Lines: 43
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <42805FE7.8030405@usq.edu.au>
References: <4280298A.6090305@usq.edu.au> <2NXfe.4884$eU.970@fed1read07>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.demon.co.uk 1115845128 9711 158.152.254.254 (11 May 2005 20:58:48 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Wed, 11 May 2005 20:58:48 +0000 (UTC)
X-Abuse: abuse@usq.edu.au
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Original-Trace: 10 May 2005 17:14:22 +1000, 139.86.144.166
X-User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041217
X-Accept-Language: en-au, en-us, en
X-Virus-Scanned: by amavisd-new at cs.mu.OZ.AU
X-Original-NNTP-Posting-Host: 139.86.144.166
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id j4BKwfbK028708;
	Thu, 12 May 2005 06:58:41 +1000 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-Delivered-To: std-c++@ucar.edu
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:4693

James Dennett wrote:
> Ron House wrote:
> 
>> I don't know if this has been suggested, but a neat way to refer to 
>> the parent of a class would be very useful. Thus, if C inherits from 
>> B, "parent" used inside C, would be B. This would be handy with 
>> template arguments, and when classes include code from macros or 
>> templates that want to mention the ancestor. I ran into the problem 
>> when designing a system to automatically generate a collection of 
>> classes for writing html from special short descriptions of html 
>> elements. My canned code got inserted into various classes and I 
>> needed to call ancestor methods. I found I had to keep track of the 
>> ancestor class names with complicated macros.
>>
> 
> This has been discussed a number of times here:
> http://groups-beta.google.com/group/comp.std.c++/browse_thread/thread/bcdfb80dbd695f38/cc4cde7f50c0fd8b?q=comp.std.C%2B%2B+parent&rnum=4#cc4cde7f50c0fd8b 
> 
> or
> http://groups-beta.google.com/group/comp.std.c++/browse_thread/thread/745b8fd5e5fadce3/61758e00b849500f?q=comp.std.C%2B%2B+parent&rnum=6#61758e00b849500f 
> 
> would be examples.  Names suggested include "super" and "inherited".
> In the past the idea hasn't had all that much support, given that
> it's not hard to add a typedef manually and that generalizations to
> multiple inheritance are either restricted or complicated.

Yes, multiple inheritance is the problem area, of course. But I think 
the utility of it in automatically-generated code is being 
underestimated if it was suggested that the problem is always easy to 
fix with a typedef or two. Perhaps it is easily disposed of by treating 
it like ambiguous function calls - if there is no ambiguity, it gives 
you the parent, otherwise you can't use it.

-- 
Ron House     house@usq.edu.au
               http://www.sci.usq.edu.au/staff/house

---
[ 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                       ]



