Newbie asking about overloading functions
The book I am using to teach myself C++ shows the format for overloading functions but doesn't seem to go into great detail on how to use them. In an attempt to get a better handle on the concept I wrote code declaring four functions: Data_Type(int), Data_Type(double), Data_Type(float), and Data_Type(char).
My understanding is that when the Data_Type function is called, the type of parameter passed in will determine which of the four is actually used. Is that a correct assesment?
Assuming that I'm not completely misunderstanding the concept, one of the ways I'd like to use it is to write code the will call the appropiate function based on the type of input received (e.g., one function if the input is an int, anther if it's a double, etc).
However, since simply saying "cin >> Data_Type();" won't work, I'm stumped on how to construct the cin statement when I'm not sure what data type is going to be entered.
Any help or suggestions you'd be willing to offer a confused newbie would be greatly appreciated.
-Thanks