Newsgroups: comp.lang.c++
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!linus!linus!mbunix!mmk
From: mmk@d62iwa.mitre.org (Morris M. Keesan)
Subject: Re: MEMBER ACCESS
In-Reply-To: steve@taumet.com's message of 4 Jun 91 15:46:21 GMT
Message-ID: <MMK.91Jun4133001@d62iwa.mitre.org>
Sender: news@linus.mitre.org (News Service)
Nntp-Posting-Host: d62iwa.mitre.org
Organization: The Mitre Corp., Bedford, MA.
References: <97edfa6b92f028446f60@rose.uucp> <2351@media03.UUCP>
	<14893@ector.cs.purdue.edu> <758@taumet.com>
Date: 4 Jun 91 13:30:01

In article <758@taumet.com> steve@taumet.com (Stephen Clamage) writes:

>  svb@cs.purdue.EDU (Stephan Bechtolsheim) writes:
>  >As far as I am concerned
>  >	A.get_x()
>  >doesn't read as well as does
>  >	A.x
>
>  You can name the private data member priv_x and the access function x().
>  This leaves you with A.x() for reading the data.
>
>  In another article, Joe Buck gives an excellent summary of why in general
>  you don't want to provide direct access to data members.

And you can also, if you really want to see A.x instead of anything with (),
you can name the private data member priv_x, the access function get_priv_x(),
and
#define x get_priv_x()

