Why does C++ allow unnamed function parameters?
问题 The following is a perfectly legal C++ code void foo (int) { cout << "Yo!" << endl; } int main (int argc, char const *argv[]) { foo(5); return 0; } I wonder, if there a value to ever leave unnamed parameters in functions, given the fact that they can't be referenced from within the function. Why is this legal to begin with? 回答1: Yes, this is legal. This is useful for implementations of virtuals from the base class in implementations that do not intend on using the corresponding parameter: you