X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: Why does this code fails? Date: 11 Mar 2004 11:19:59 GMT Organization: Aachen University of Technology (RWTH) Lines: 22 Message-ID: References: NNTP-Posting-Host: ac3b07.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 1079003999 19126 137.226.33.205 (11 Mar 2004 11:19:59 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 11 Mar 2004 11:19:59 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Anthony wrote: > Why doesn't convertion by default work? Because there's no particular reason it should. Your new class "mystream" has no relation to the standard C++ library classes, and thus it inherits none of their overloaded operators. > How to make it work with no cast-ing? > The goal is to have a global static reference to a stream, where some code > can do output and another code can change this output destanation, like make > it go to cout, then after sometime to a file stream, etc. Is there better > way to do this than this code? Just make a global pointer to an object of type ostream and overwrite what that points to, if you have to. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.