Unfortunately, this is possible. But in no sense can I condone it.
#include <iostream>
namespace std
{
class not_actually_cout{};
template<typename T>
not_actually_cout& operator<< (not_actually_cout& stream, const T & v)
{
std::cout << v << std::endl;
return stream;
}
not_actually_cout not_actually_cout_instance;
}
#define cout not_actually_cout_instance
int main(void)
{
cout << "why god why";
cout << "please no";
return 0;
}
Outputs:
why god why
please no
3
solved Replace cout<<"string" with cout<<"string"<