home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13651 < prev    next >
Encoding:
Text File  |  1992-09-14  |  999 b   |  34 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!wupost!m.cs.uiuc.edu!sunb10.cs.uiuc.edu!sparc10.cs.uiuc.edu!pjl
  3. From: pjl@sparc10.cs.uiuc.edu (Paul Lucas)
  4. Subject: Re: A question about "const".
  5. Message-ID: <1992Sep15.025609.13697@sunb10.cs.uiuc.edu>
  6. Sender: news@sunb10.cs.uiuc.edu
  7. Organization: University of Illinois at Urbana-Champaign
  8. References: <193h6dINN2of@miles.mps.ohio-state.edu>
  9. Distribution: usa
  10. Date: Tue, 15 Sep 1992 02:56:09 GMT
  11. Lines: 21
  12.  
  13. In <193h6dINN2of@miles.mps.ohio-state.edu> ren@miles.mps.ohio-state.edu (Liming Ren) writes:
  14.  
  15. > Could somebody tell me what the role of const is in the following code?
  16. >I am new to C++. 
  17.  
  18.  
  19. >class    String{
  20. >public:
  21. >    int length() const {return len;} //The const in between ) and {
  22. >    //...
  23. >private:
  24. >    int len;
  25. >    char *str;
  26.  
  27. >}
  28.  
  29. *****>    ARM, p.177 -or- Stroustrup, 2nd ed., p.148.
  30. -- 
  31.     - Paul J. Lucas                University of Illinois    
  32.       AT&T Bell Laboratories        at Urbana-Champaign
  33.       Naperville, IL            pjl@cs.uiuc.edu
  34.