Quiz 38
Anonymous
2,342 views
description:
Any construct that could possibly be considered a declaration is a declaration. In this example, the second line of main is interpreted as a function declaration in preference to an object declaration with initialization.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
struct Foo
{
Foo(int d) : x(d) {}
int x;
};
int main()
{
double x = 3.14;
Foo f( int(x) );
std::cout << f.x << std::endl;
return 0;
}
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.