home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / cplus / 17826 < prev    next >
Encoding:
Text File  |  1992-12-11  |  1.1 KB  |  34 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!usc!news.service.uci.edu!unogate!mvb.saic.com!ast.saic.com!dobbs
  3. From: dobbs@ast.saic.com (Lynn Dobbs)
  4. Subject: Re: Public access to private data member
  5. Message-ID: <1992Dec11.195843.1872@ast.saic.com>
  6. Sender: news@ast.saic.com
  7. Organization: SAIC
  8. References: <28575.9212111556@louis.ecs.soton.ac.uk> <Bz3xH1.9uq@cs.uiuc.edu>
  9. Date: Fri, 11 Dec 1992 19:58:43 GMT
  10. Lines: 22
  11.  
  12. In article <Bz3xH1.9uq@cs.uiuc.edu> pjl@cs.uiuc.edu (Paul Lucas) writes:
  13. >In <28575.9212111556@louis.ecs.soton.ac.uk> Stuart Maclean <S.D.Maclean@ecs.soton.ac.uk> writes:
  14. >
  15. >>void Screen::copy( Screen& s )
  16. >>{
  17. >>  delete screen;
  18. >>  height = s.height;
  19. >>  width = s.width;
  20. >
  21. >>My question is;
  22. >>  Why are the data members s.height and s.width accessible to copy,
  23. >>  even though both height and width are declared private. Is
  24. >>  it just because s happens to be of the same class as the target
  25. >>  object ??
  26. >
  27. >*****>    Yes.
  28. >-- 
  29. Copy is a member fucntion. If the data members weren't accessible to
  30. member or friend functions, what good would they be?
  31. --Lynn
  32. "Who is John Galt?"
  33.  
  34.