C (47/178)

From:Johan Rasten
Date:14 Jul 2000 at 12:49:30
Subject:overloading operators

Hi! Can I overload operator<< for a class so I could write like this:

int i = 23;
char *b = "hello";

myprintclass << "hi " << b << ", test " << i;

and have myprintclass launch the apropriate functions?

(instead of having to write:

myprintclass.out("hi ");
myprintclass.out(b);
myprintclass.out(", test ");
myprintclass.out(i);

)

please help!

/Johan



http://hem1.passagen.se/zman/main.html

We are on the verge: Today our program proved
Fermat's next-to-last theorem.
-- Epigrams in Programming, ACM SIGPLAN Sept. 1982

------------------------------------------------------------------------
Life's too short to send boring email. Let SuperSig come to the rescue.
http://click.egroups.com/1/6809/1/_/451227/_/963571939/
------------------------------------------------------------------------