Question

Hell ! I'm trying to make a class that would help me with outputting text to stdout ... Anyway, everything is working, except for one thing. Let's say that I've create object of my class called out. When I do this, everything works prefectly:

out<<"test test"<<std::endl;

And it also works when I do this:

out<<QString("another string")<<std::endl;

But, when I try to chain these two thing together, like this:

out<<"test test"<<std::endl<<QString("another string")<<std::endl;

I get that super-big error, that's eventually telling me that operator<< doesn't accept parameter of type QString. That's strange, because it works OK when I don't chain QString ... Also this works:

out<<"test test"<<std::endl<<"another string"<<std::endl;

and this:

out<<QString("another string")<<std::endl<<"test test"<<std::endl;

So I guess I have problem with my operator<< function ... Either I didn't make operator<< correctly, or I don't return correct value. Or maybe something else is wrong. Anyway, I can't figure it out, so could you help me ? Bellow is source code:

output.h: http://xx77abs.pastebin.com/b9tVV0AV output.cpp: http://xx77abs.pastebin.com/5QwtZRXc

And of course, the super-big error :D

http://xx77abs.pastebin.com/8mAGWn47

EDIT: for all you wondering, I'm not using namespaces ...

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top