I'm sorry, I haven't programmed C++ in a while, I'd like to refresh my knowledge about what exact rule I'm violating here:
I can do:
int main()
{
int a(5);
}
but cannot do:
struct Foo
{
int a(5); // Error: expected a type specifier / Error: syntax error, 'constant'
}
I am trying to regain some lost knowledge, can someone direct me to the rule that disallows this? I'm pretty sure there'd be a question about it on here, I couldn't find it. The only thing I remember is that the committee debated (for C++11 I think) in class constructor arguments and introduced new squiggly bracket constructor initialisers, like int a{5}; but I would like to know why int a(5); isn't allowed inside a class. Has this always been disallowed in C++?