Article View: comp.std.c++
Article #237virtually typed return values [WAS: the most dissatisfying part of c++]
From: Reid Ellis
Date: Wed, 01 Aug 1990 15:42
Date: Wed, 01 Aug 1990 15:42
35 lines
1712 bytes
1712 bytes
schemers@vela.acs.oakland.edu (Roland Schemers III) writes:
|I understand your point of view though, and I think it would be nice
|if there was some construct in C++ to do what you want. I know some of
|my classes could use it. Maybe something like:
|
|class a {
| public:
| virtual& test() {
| // do some modification to the state of this object,
| // then ...
| return *this;
| }
|};
|
|In otherwords, make the return type 'virtual' like functions.
This is nice in that it uses an already key word. However, this
would be too easily mixed up with people just forgetting to put
type names in their functions. Rather than just
virtual &method();
how about
virtual class& method();
instead? "class" is already a keyword and it even sounds like what
it is -- a reference to the current "class". But you're right,
this sounds like the syntax proposed for templates, so maybe they
will solve this problem without this changed syntax.
Reid
--
Reid Ellis 264 Broadway Avenue, Toronto ON, M4P 1V9 Canada
rae@gpu.utcs.toronto.edu || rae%alias@csri.toronto.edu || +1 416 487 1383
Technical Details
Message-ID:
<rae.649525332@fred>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!usc!wuarchive!mailrus!news-server.csri.toronto.edu!torsqnt!lethe!geac!alias!fred!raeReferences:
<27634@netnews.upenn.edu> <2314@vela.acs.oakland.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!samsung!usc!wuarchive!mailrus!news-server.csri.toronto.edu!torsqnt!lethe!geac!alias!fred!rae From: rae@gpu.utcs.toronto.edu (Reid Ellis) Newsgroups: comp.std.c++ Subject: virtually typed return values [WAS: the most dissatisfying part of c++] Message-ID: <rae.649525332@fred> Date: 1 Aug 90 15:42:12 GMT References: <27634@netnews.upenn.edu> <2314@vela.acs.oakland.edu> Sender: Reid Ellis <rae%alias@csri.toronto.edu> Reply-To: Reid Ellis <rae@gpu.utcs.toronto.edu> Organization: Alias Research, Inc. Toronto ON Canada Lines: 35