Article View: comp.std.c++
Article #3815Re: constness of private members and methods
From: James Kanze US/ESC 60/3/141 #407...
Date: Tue, 26 Mar 1996 16:22
Date: Tue, 26 Mar 1996 16:22
34 lines
2064 bytes
2064 bytes
In article <4j49e0$8fo@dub-news-svc-4.compuserve.com> Philippe Verdy
<100105.3120@compuserve.com> writes:
|> Would not it be great if we could simply define such members
|> as "unconst" like in the following example :
|> class T {
|> public:
|> T() { ...; _mark = 0; }
|> virtual ~T();
|> virtual void show() const;
|> protected:
|> void mark() const { _mark = 1; } // RELAXED HERE
|> void unmark() const { _mark = 0; } // RELAXED HERE
|> bool ismarked() const { return _mark; }
|> private:
|> unconst char _mark; // HERE IS WHERE THIS APPLIES
|> }
You can. Except that `unconst' is spelled `mutable'.
--
James Kanze Tel.: (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
-- A la recherche d'une activité dans une region francophone
[ 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 ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Technical Details
Message-ID:
<KANZE.96Mar26121837@slsvipt.lts.sel.alcatel.de>Path:
arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamageReferences:
<4j49e0$8fo@dub-news-svc-4.compuserve.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763) Newsgroups: comp.std.c++ Subject: Re: constness of private members and methods Date: 26 Mar 1996 16:22:59 GMT Organization: GABI Software, Sarl. Sender: news@lts.sel.alcatel.de Approved: clamage@eng.sun.com (comp.std.c++) Message-ID: <KANZE.96Mar26121837@slsvipt.lts.sel.alcatel.de> References: <4j49e0$8fo@dub-news-svc-4.compuserve.com> NNTP-Posting-Host: taumet.eng.sun.com In-Reply-To: Philippe Verdy's message of 25 Mar 1996 10:04:56 PST Apparently-To: std-c++@ncar.ucar.edu Content-Length: 967 X-Lines: 27 Originator: clamage@taumet