Name: Anonymous 2007-01-15 20:15
hi /prog/
suppose I had a class
class ABC
{
public:
ABC() {}
void print(std::string s) { // do something with s }
};
and in my program I wanted to do:
ABC a;
a << "hello " << "world" << someVariable << endl;
but I wanted the << operator to call print, passing the formatted string as s.
how would i do this?
suppose I had a class
class ABC
{
public:
ABC() {}
void print(std::string s) { // do something with s }
};
and in my program I wanted to do:
ABC a;
a << "hello " << "world" << someVariable << endl;
but I wanted the << operator to call print, passing the formatted string as s.
how would i do this?