Mar 15, 2014 at 6:51pm UTC
We're working on classes in my programming class, and I have a question about function calls.
Bascially, I have all my set and get functions set up and ready to go.
I was wondering if it was possible to have the user input a variable while calling a function.
cin >> getname();
the user inputs a value that gets passed into getname.
Or does it have to be something like
cin >> name;
mind you all, this isn't code from my program i'm just spitballing here.
Mar 15, 2014 at 7:08pm UTC
Nope, it is not possible. You should input something into variable and pass it into function. (Technically it is possible to do something similar using templated function wrapper, but it is a perversion.)
Mar 15, 2014 at 8:21pm UTC
But isn't he wanted that inputted value was passed to function as argument?
Mar 16, 2014 at 6:48pm UTC
ok, cool beans. thanks everyone.