Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!ulysses!hector!jss From: jss@hector.UUCP (Jerry Schwarz) Newsgroups: comp.lang.c++ Subject: Re: Use of inheritance for classification? (iostream) Keywords: MI, iostream Message-ID: <11563@ulysses.homer.nj.att.com> Date: 20 May 89 16:52:37 GMT References: <11557@ulysses.homer.nj.att.com> <30582@apple.Apple.COM> <10248@riks.csl.sony.JUNET> <329@odi.ODI.COM> <327@calmasd.Prime.COM> <3297@kalliope.rice.edu> Sender: netnews@ulysses.homer.nj.att.com Reply-To: jss@hector.UUCP (Jerry Schwarz) Organization: AT&T Bell Laboratories Lines: 40 I gave as an example: The iostream library that is scheduled to be part of 2.0 uses class ios { ... } class istream : virtual public ios { ... } ; class ostream : virtual public ios { ... } ; class iostream : public istream, public ostream { ... } ; Input operations are allowed on istreams. Output operations on ostreams. iostreams allow both operations (as when updating disk files) In article <3297@kalliope.rice.edu> rich@kappa.Rice.EDU (Richard Murphey) presents a similar example class iostream : public istream, public ostream { iostream(); }; iostream::iostream() :istream(stdin), ostream(stdout) { } The idea of pairing an istream with an ostream in this way is interesting, but it is subtly different from my example. The 2.0 iostream library puts the "data" into ios, so that an iostream has only one set of data. If Rich had done something that tried to examine the error state (for example) he would have encountered difficulties because there are two such in his iostream. Jerry Schwarz AT&T Bell Labs, Murray Hill