I want a method to alter multiple variables outside of it, which, if I understand correctly wouldn't/couldn't change outside the scope of that function, unless specifying and returning a specific type. I also know I can't return multiple types from a function.
struct multiTypes { int i = 0; float f = 1.0; std::string a = "testing";};multiTypes test() { multiTypes mT; mT.i += 2; return mT;}int main() { std::cout << test().i << '\n'; std::cout << test().f << '\n'; std::cout << test().a << '\n';}
While this does work, I was wondering, what other alternatives exist to achieve the same result?