Nope. Now, you could put this into a function:
int readInt(std::istream& stream)
{
int i;
stream >> i; // Cross your fingers this doesn't fail
return i;
}
// Then in your code:
obj.changeval(readInt(std::cin));
But of course, this still creates an int
(it just moves it to the readInt
function).
In reality, you have to create some object/memory space for the int
to live in, so you can read it and pass it. Where you do this can be changed. But to simply answer your question: no.