"Victor Bazarov" <v.Abazarov@comAcast.net> skrev i meddelandet
news:IP2dneT7rJaTbHHZnZ2dnUVZ_r2dnZ2d@comcast.com...
puzzlecracker wrote:
example is taken from Evolution of C++.
I don't understand how the following will be interpreted:
typedef int P();
typedef int Q();
Seems like ::P is a synonym for the type "a function that takes
no arguments and returns an int".
::Q is the same type synonym as ::P.
class X{
static P(Q);
static Q(P);
These two lines are syntax errors. Implicit return type is not
allowed (there is nothing between 'static' and the names).
Only the second line is in error. On the first line, P is the type
from the typedef, so it declares Q as a static something (a function I
guess:-).
On the second line, the new X::Q hides the type Q so it doesn't work
here.
Writing the lines as
static P Q;
static Q P;
would have made it too obvious.
Bo Persson
};
V
.