just a question I've been reading tutorials and no one actually explains why you need to use an ostream object when overloading the << operator why can't I just use my object to overload the << operator
I'll make another suggestion, get rid of usingnamespace std;, use std::cout instead.
1.3a — A first look at cout, cin, endl, the std namespace, and using statements
http://www.learncpp.com/cpp-tutorial/1-3a-a-first-look-at-cout-cin-endl-namespaces-and-using-statements/
usingnamespace std; is not wrong, but just bad practice. Especially when used at global scope.
Why is " using namespace std " in C++ considered bad practice - Stack Overflow
http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-in-c-considered-bad-practice
thanks FurryGuy yeah I seen in other threads people mention it's better practice to use std::cout etc instead of using namespace std I'll look into it =)
When I first started out learning C++ I used usingnamespace std;. After having more than a few people suggest using it could cause problems I stopped using it.
Now I can't type just cout, my fingers automatically add the std:: even if I am modifying code that has the using directive (usingnamespace std;).