home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / std / cplus / 1136 < prev    next >
Encoding:
Text File  |  1992-09-08  |  1.2 KB  |  33 lines

  1. Newsgroups: comp.std.c++
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!wupost!zaphod.mps.ohio-state.edu!rpi!clarkson!news.clarkson.edu!cline
  3. From: cline@sun.soe.clarkson.edu (Marshall Cline)
  4. Subject: Re: Is coercion to a reference defined?
  5. In-Reply-To: moudgill@cs.cornell.edu's message of Sun, 6 Sep 1992 18:29:05 GMT
  6. Message-ID: <CLINE.92Sep8235800@sunspot.clarkson.edu>
  7. Sender: news@news.clarkson.edu
  8. Nntp-Posting-Host: sunspot.ece.clarkson.edu
  9. Reply-To: cline@sun.soe.clarkson.edu (Marshall Cline)
  10. Organization: Paradigm Shift, Inc (C++/Reuse/OOD/OO-mgmt training)
  11. References: <1992Sep6.182905.6603@cs.cornell.edu>
  12. Date: Wed, 9 Sep 1992 04:58:00 GMT
  13. Lines: 18
  14.  
  15. In article <1992Sep6.182905.6603@cs.cornell.edu> moudgill@cs.cornell.edu ( Mayan Moudgill) writes:
  16. ...
  17. >I'd like to define TWO functions:
  18. >     operator T () { return _value;}
  19. >and
  20. >     operator T& () { return _value;}
  21.  
  22. They would, as stated, be ambiguous.  However, you can make the first one
  23. a `const' member function, thereby disambiguating them based on the constness
  24. of the object being converted to a T.
  25.  
  26. ++Marshall
  27. --
  28. Marshall Cline
  29. --
  30. Marshall P. Cline, Ph.D. / Paradigm Shift, Inc / 65 N Main St/Norwood, NY 13668
  31. cline@sun.soe.clarkson.edu / 315-353-4585 / FAX: 315-353-6100
  32. Maintainer, C++ FAQ
  33.