home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13407 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  972 b 

  1. Path: sparky!uunet!igor!thor!rmartin
  2. From: rmartin@thor.Rational.COM (Bob Martin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Novice question
  5. Message-ID: <rmartin.715993652@thor>
  6. Date: 8 Sep 92 23:07:32 GMT
  7. References: <H7ZyoB6w164w@cellar.org> <1992Sep3.164747.25939@news.miami.edu> <1992Sep4.194039.23622@advtech.uswest.com> <1992Sep5.000938.9187@lut.ac.uk>
  8. Sender: news@Rational.COM
  9. Lines: 31
  10.  
  11. J.March@lut.ac.uk writes:
  12.  
  13. |Why dosn't this work?...
  14.  
  15. |class thing 
  16. |{
  17. |    ...
  18. |    void    f();
  19. |    void    g();
  20. |}
  21.  
  22. |void main()
  23. |{
  24. |    thing obj;
  25.  
  26. |    obj.f().g();
  27. |}
  28.  
  29.  
  30. This can be rewritten as  ( obj.f() ).g();
  31.  
  32. The return value of (obj.f()) is void.  So you are trying to invoke the g() member function of a 'void'.  This is a non-sequitur.
  33.  
  34.  
  35.  
  36.  
  37. --
  38. Robert Martin                        Training courses offered in:
  39. R. C. M. Consulting                       Object Oriented Analysis
  40. 2080 Cranbrook Rd.                        Object Oriented Design
  41. Green Oaks, Il 60048 (708) 918-1004       C++
  42.