Brian S ecrivait ce qui suit dans un message a All:
Maybee you can try this:
#include
class myoutput {
public:
void operator << (char *s, *t, *u, *v, *w, *x, *y, *z)
{
cout << s << t << u << v << w << x << y << z;
}
};
But i'm not sure if it will work...
BS> I was trying to make a class that worked similar to the cout class,
BS> just for some practice and I was wondering if anyone could help.
BS> This is what I have done so far :
BS> -------------------------------------------------------------------
BS> ------- #include
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> -------
BS> I would like to be able to call my << function multiple times like
BS> the cout class. for example :
BS> write << "Hello " << "World";
BS> Can anyone help?
BS> Drumstick
BS> =======O O=======
BS> ___ FMail/Win32 1.22
BS> - Origin: CompuNerds BBS (602)497-2219 Mesa Arizona (1:114/480)
Vincent Gibara
vince@qanet.org
www.qanet.org
--- FMailX 1.40g
---------------
* Origin: cool.world 418-843-0162 - Quebec City! (1:240/99)
|