TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: BRIAN S
from: THOMAS MAEDER
date: 1997-10-31 16:33:00
subject: write

BS> class myoutput {
BS>   public:
BS>     void operator<< (char* s)
BS>       {
BS>         cout << s;
BS>       }
BS> };
BS> void main ()
BS> {
BS>   myoutput write;
BS>   write << "Hello World";
BS> }
BS> --------------------------------------------------------------------
BS> I would like to be able to call my << function multiple times like t
BS> class.  for example :
BS> write << "Hello " << "World";
Change your operator << to:
myoutput &operator<< (char* s)
{
    cout << s;
    return *this;
}
Thomas
---
 þ MM 1.0 #0113 þ Infinity is one lawyer waiting for another.
--- PCBoard (R) v15.22/M 25
---------------
* Origin: McMeier & Son BBS (2:301/138)

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™.