home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / cplus / 16629 < prev    next >
Encoding:
Internet Message Format  |  1992-11-20  |  1.8 KB

  1. Path: sparky!uunet!mcsun!sunic!hagbard!loglule!jbn
  2. From: jbn@lulea.trab.se (Johan Bengtsson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Just what is so great about streams?
  5. Message-ID: <5241@holden.lulea.trab.se>
  6. Date: 20 Nov 92 11:21:18 GMT
  7. References: <1992Nov19.131702.1@vax1.bham.ac.uk>
  8. Organization: Telia Research AB, Aurorum 6, 951 75 Lulea, Sweden
  9. Lines: 25
  10. X-Newsreader: Tin 1.1 PL4
  11.  
  12. mccauleyba@vax1.bham.ac.uk (Brian McCauley) writes:
  13. : In article <1992Nov18.205139.12711@bcrka451.bnr.ca>, sjm@bcrki65.bnr.ca (Stuart MacMartin) writes:
  14. : > 
  15. : > Perhaps I was thinking too general.  If the class of fout does not need to
  16. : > redefine operator<<(), everything is ok.  But if there is some processing
  17. : > that has to be done before the data is passed to the underlying stream, 
  18. : > doesn't the class of fout have to redefine operator<<()?  In which case
  19. : > my example does not work.  Because operator<<() is *not* virtual.  I don't
  20. : > think it is true that TimeStamp can properly write to *any* class that 
  21. : > is ultimately derived from ostream.  And if it can, I'd sure like to know how.
  22. : Yes this is true. This is why classes derived from a stream class should
  23. : _not_ redifine operator<<.  Different stream classes differ only in their
  24. : IO end not their data formatting end.
  25.  
  26. Which means that stream subclasses are forever restricted to
  27. be simply forwarding classes to streambufs, right?
  28.  
  29. Kind of shows that the design with separate ios and streambuf hierarchies
  30. is unnecessarily complicated, IMHO.  Anyone care to comment?
  31. -- 
  32. --------------------------------------------------------------------------
  33. | Johan Bengtsson, Telia Research AB, Aurorum 6, S-951 75 Lulea, Sweden  |
  34. | Johan.Bengtsson@lulea.trab.se; Voice:(+46)92075471; Fax:(+46)92075490  |
  35. --------------------------------------------------------------------------
  36.