TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: BRIAN S
from: CAMERON CLARK
date: 1997-10-28 15:49:00
subject: Re: write

BS> void main ()
BS> {
BS>   myoutput write;
BS>   write << "Hello World";
BS> }
BS> 
-------------------------------------------------------------------------
BS> 
BS> I would like to be able to call my << function multiple times like the 
cout
BS> class.  for example :
BS> 
BS> write << "Hello " << "World";
    Overload the '<<' operator for each primitive data type like so.
    friend myoutput& operator<< (myoutput& m, char* c) {
       m.Ostream << c;
       return m;
    }
    // I'm assuming that Ostream is an ostream object
    myoutput m;
    m << "String 1" << "string 2";
    m<<"String 1" - returns a myouput reference
    myouput& << "string 2" - returns a myoutput reference
--- GEcho 1.00
---------------
* Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.