You are right, I know it is a complete waste of time, and there is not much of a point in doing it, but honestly, thinking about it there isn't much point to programming in general, people do it because it's fun (or maybe it's the money....) either way, I am doing because I am trying to learn about user defined operators, data types, and overloading operators, and I was trying to learn about the << operator which std::cout uses, I want to understand how cout works as most functions would follow something like the following func(VarToPrint); not func operator VarToPrint
All else aside, I am working on a (pointless) framework, without the use of other libraries. Honestly, time is nothing I am worried about. This is for enjoyment and educational purposes, believe it or not.
Anyways, sorry for the rant, could you point me to somewhere to start making my own Print function using operators, thanks!
Have you looked at the reference page? http://www.cplusplus.com/reference/ Shows a picture of how the streams break down under Input/Output Stream Library. May be something to look at before looking into making our own.
@ OP: First you should realize that the operator ("<<" in this case) and the object (std::cout) are separate entities. Operators are built into the C++ language, this is why you can overload the existing ones them but you can never add your own.
Each object in C++ has the ability to assign specific behavior to each operator. Technically you can have the "<<" operator perform addition in the context of your object if you wanted to, it is obnoxious but possible. The std::cout object is an instance of std::basic_ostream which is created by default and associated with the stream buffer of the systems default output device to eliminate the redundant typing that you have to do.
Thank you, I am aware that operators can be used for different purposes in different objects, and the cout is an object of basic_ostream, I am also aware that there are indeed ways to create your own operators, however I have no looked into it. Yet.
Thank you for the link, I will surely look into that!
m, I am also aware that there are indeed ways to create your own operators
you can tell any built in operator to do what you want (as long as it involves more than just base types) but in c++ you cannot create your own operators like **, and for good reason
actually they are labeled as macros. that site is incorrectly calling them operators. and that logic isnt sound. if i make a class called Int, that takes an int, and can use ==, !=, <, >, <=, >=, +, -, ++... etc its not really an int. its a class wrapped around an int, even though it looks, acts, and is used like an int