Y
Yudan Yi \(OSU\)
I have a question to define a friend operator<< for a class.
for example, I can define
friend ostream& operator<<(ostream& os, const TTest& x) { ...; return
(os); };
While I want to add more control to the output by an additional parameter,
can I do in the following way?
friend ostream& operator<<(ostream& os, const TTest& x, unsigned parameter)
{
switch (parameter)
{
case: ...
}
return (os);
};
If I can define in this way, then how can I use it? if not, how can I do it?
Thanks
for example, I can define
friend ostream& operator<<(ostream& os, const TTest& x) { ...; return
(os); };
While I want to add more control to the output by an additional parameter,
can I do in the following way?
friend ostream& operator<<(ostream& os, const TTest& x, unsigned parameter)
{
switch (parameter)
{
case: ...
}
return (os);
};
If I can define in this way, then how can I use it? if not, how can I do it?
Thanks