www.digitalmars.com         C & C++   DMDScript  

c++.chat - Creating something resembling to cout << endl;

Hi,

I'm trying to build a class operating a dos-screen and I would like to be able
stuff like the iostream functionality :
cout << endl;

I've seen endl is a function ...

I'm trying to build a class around disp functions allowing following :

screen << SetPostion(20,10) << SetColor(green, black) << "Hello World!";

I've already worked it up to the point where I've programmed the operator<<
functions and their doing the job the only annoying thing is that I've got to
prefix all the functions by the classname :

screen << cScreen.SetPostion(20,10) << cScreen.SetColor(green, black) << "Hello
World!";

and I'd like to get rid of it like the endl function.

Can somebody help me how I should start handling it. (I'm guessing they will
have to be friend functions, but how to handle the parameters and updating the
class elements and stuff like that.)

The second part is how to get rid of the brackets behinsd the function call if
it does not require anything ?


Yhanks for the help ...
If anyone should be interested afterwards I could share the class ;)

--

Nascar

Mens Sana In Corpore Sano
Oct 22 2004