can you cobine a function call and inputting a value?

Hello all,

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.

for example

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.
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.)
std::string& getname(){
  return this->name;

std::cin >> foo.getname();
But isn't he wanted that inputted value was passed to function as argument?
ok, cool beans. thanks everyone.
Topic archived. No new replies allowed.