home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!usc!news.service.uci.edu!unogate!mvb.saic.com!ast.saic.com!dobbs
- From: dobbs@ast.saic.com (Lynn Dobbs)
- Subject: Re: Public access to private data member
- Message-ID: <1992Dec11.195843.1872@ast.saic.com>
- Sender: news@ast.saic.com
- Organization: SAIC
- References: <28575.9212111556@louis.ecs.soton.ac.uk> <Bz3xH1.9uq@cs.uiuc.edu>
- Date: Fri, 11 Dec 1992 19:58:43 GMT
- Lines: 22
-
- In article <Bz3xH1.9uq@cs.uiuc.edu> pjl@cs.uiuc.edu (Paul Lucas) writes:
- >In <28575.9212111556@louis.ecs.soton.ac.uk> Stuart Maclean <S.D.Maclean@ecs.soton.ac.uk> writes:
- >
- >>void Screen::copy( Screen& s )
- >>{
- >> delete screen;
- >> height = s.height;
- >> width = s.width;
- >
- >>My question is;
- >> Why are the data members s.height and s.width accessible to copy,
- >> even though both height and width are declared private. Is
- >> it just because s happens to be of the same class as the target
- >> object ??
- >
- >*****> Yes.
- >--
- Copy is a member fucntion. If the data members weren't accessible to
- member or friend functions, what good would they be?
- --Lynn
- "Who is John Galt?"
-
-