home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!spool.mu.edu!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!uxa.cso.uiuc.edu!jdl47513
- From: jdl47513@uxa.cso.uiuc.edu (Jason Lowe)
- Subject: Problems with reference function and consts
- Message-ID: <Bun6vx.BtJ@news.cso.uiuc.edu>
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Organization: University of Illinois at Urbana
- Date: Tue, 15 Sep 1992 23:07:03 GMT
- Keywords: const
- Lines: 20
-
- I am sorry if this is in a FAQ somewhere...
-
- I have a class that overloads the [] operator, returning a reference to type
- int. I also have a const declared ie:
-
- const errorval = -1;
-
- When I try to return errorval in the overloaded operator[] function, CC gives
- me a warning about temporary variable reference (not lvalue or incorrect type)
-
- If I ignore the warning, the code runs incorrectly. Is it possible to return
- a reference to a const? If so, what is wrong? Please email and thanks in
- advance!
-
-
-
- --
- Jason Lowe | // | Take the Oath. Watch Ren and Stimpy!
- stimpy@uiuc.edu | \X/ Amiga! | "And look, he's beating up on our cheese!"
-
-