Article View: net.lang.c++
Article #304`inherited' keyword
From: Sam Kendall
Date: Fri, 12 Sep 1986 21:17
Date: Fri, 12 Sep 1986 21:17
36 lines
1992 bytes
1992 bytes
I just read a draft of the C+- specification from Apple. It mentions a
keyword `inherited' as "a proposed addition to C++ that has not yet been
adopted by AT&T," used (in C+-) as follows:
inherited::virtual_function
This gets you the virtual function belonging to the nearest superclass.
What is not mentioned in the C+- document, and what I would like to
know, is
(1) Does `inherited' work for members other than virtual functions? It
certainly should. If static virtual data items are allowed in C++
(are they? I couldn't find anything in the ref man that prohibits
them) then inherited should work for them, too.
(2) What is the current status of this construct? Something like it is
certainly needed to make it easier to do a Smalltalk-like
send super.
John Rose, a co-worker of mine, came up with a syntax for send super
<same message>. It is just `continue()' called as a function; used
inside a member function `f', it calls the same thing as
`inherited::f()', and works for non-virtual as well as virtual
functions.
A general point: the `continue' keyword is available and could be used
in place of `inherited'. It is no less clear than `inherited' --
`inherited' is really the wrong word here, since you use `inherited'
for precisely those things which were NOT inherited. I suppose
`inherited' is supposed to stand for "would have been inherited".
`continue' can be thought of as meaning "continue up the inheritance
tree".
---
Sam Kendall sam@Think.COM
Thinking Machines Corp. ihnp4!think!sam
Technical Details
Message-ID:
<6190@think.COM>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!think!samShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!think!sam From: sam@think.COM (Sam Kendall) Newsgroups: net.lang.c++ Subject: `inherited' keyword Message-ID: <6190@think.COM> Date: Fri, 12-Sep-86 17:17:47 EDT Article-I.D.: think.6190 Posted: Fri Sep 12 17:17:47 1986 Date-Received: Fri, 12-Sep-86 22:42:52 EDT Organization: Thinking Machines, Cambridge, MA Lines: 36