home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12379 < prev    next >
Encoding:
Text File  |  1992-08-15  |  709 b   |  29 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!stanford.edu!agate!tfs.com!tfs.com!eric
  3. From: eric@tfs.com (Eric Smith)
  4. Subject: Re: pointer to constant object violation
  5. Message-ID: <1992Aug15.160838.28760@tfs.com>
  6. Organization: TFS
  7. References: <1992Aug15.133926@iti.gov.sg>
  8. Date: Sat, 15 Aug 1992 16:08:38 GMT
  9. Lines: 18
  10.  
  11. In article <1992Aug15.133926@iti.gov.sg> nicholas@iti.gov.sg (Nicholas Tan) writes:
  12. >typedef char*        STR;
  13. >//#define STR        char*
  14. >
  15. >
  16. >class String
  17. >{
  18. >    private:
  19. >        STR str;
  20. >
  21. >    public:
  22. >        String(STR = "");
  23. >        const STR value() const;
  24.         ^^^^^^^^^
  25. That is equivalent to char * const, not const char *
  26.  
  27. i.e., it's parsed as (const (char *)) for the typedef, vs ((const char) *)
  28. for the #define.
  29.