3 ms·
foo()-with the parenthesis- is a function. foo-without the parenthesis-is a variable. That means that: Foo foo(); is a function pointer declaration within t
by cube13 14y ago
foo()-with the parenthesis- is a function. foo-without the parenthesis-is a variable. That means that:
Foo foo();
is a function pointer declaration within the scope of the main function. Since it's a function, which does not have member types, a is not within the scope of Foo().
Now, if there was a 0 argument constructor for struct Foo, this would be valid:
Foo foo = Foo();
- kelnos 14y agoFunction declaration, not function pointer declaration. The latter would be Foo (*foo)();