I've seen in an article a code similar to this one:
#include <iostream>
class MyClass {
public:
auto myFunction(int i)->void {
std::cout << "Argument is " << i << std::endl;
}
};
void main() {
MyClass myClass;
myClass.myFunction(4);
}
The program prints correctly the output Argument is 4, but I don't understand the signature of the class function member and what's its difference with the usual one. When it's useful to use this different signature rather than void myFunction(int i)
?