home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!wupost!m.cs.uiuc.edu!sunb10.cs.uiuc.edu!sparc10.cs.uiuc.edu!pjl
- From: pjl@sparc10.cs.uiuc.edu (Paul Lucas)
- Subject: Re: A question about "const".
- Message-ID: <1992Sep15.025609.13697@sunb10.cs.uiuc.edu>
- Sender: news@sunb10.cs.uiuc.edu
- Organization: University of Illinois at Urbana-Champaign
- References: <193h6dINN2of@miles.mps.ohio-state.edu>
- Distribution: usa
- Date: Tue, 15 Sep 1992 02:56:09 GMT
- Lines: 21
-
- In <193h6dINN2of@miles.mps.ohio-state.edu> ren@miles.mps.ohio-state.edu (Liming Ren) writes:
-
- > Could somebody tell me what the role of const is in the following code?
- >I am new to C++.
-
-
- >class String{
- >public:
- > int length() const {return len;} //The const in between ) and {
- > //...
- >private:
- > int len;
- > char *str;
-
- >}
-
- *****> ARM, p.177 -or- Stroustrup, 2nd ed., p.148.
- --
- - Paul J. Lucas University of Illinois
- AT&T Bell Laboratories at Urbana-Champaign
- Naperville, IL pjl@cs.uiuc.edu
-