I have to use “overloading functions” for this assignment.
I understand the concept and how they work, but I don’t understand how can I get input from the user then if I don’t know what it will be?
I am supposed to get input from a user and it can either be a string, double or a array of int’s. I have to figure out what the input will be and use the correct function for it.
My issue is when I get the user to input the data, where do I store it when I don’t know what it will be? I mean once I stored it I can compare and found out what the data type is which I have an idea how to do.
Any one know?
When you get input from the user, it will be a string. Period. You then have to parse it to see what it is. While you are writing a parser, you might find a use for overloaded functions.