expected '(' before '.' token ( arrr!!!! )

i see no reason why the compiler keep complaining at line 23 in the initialization list :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class window
{
public :
    /**
     * @brief
     */
    //window( const WNDCLASSEX& );
    window(
        HINSTANCE hInstance,
        WNDPROC   lpfnWinProc,
        LPCTSTR   lpszMenuName,
        LPCTSTR   lpszClassName,
        HICON     hIcon       = LoadIcon( NULL, IDI_APPLICATION ),
        HICON     hIconSm     = LoadIcon( NULL, IDI_APPLICATION ),
        UINT      style       = CS_HREDRAW | CS_VREDRAW,
        HBRUSH    hbrBackground = static_cast<HBRUSH>(GetStockObject( WHITE_BRUSH )),
        HCURSOR   hCursor     = LoadCursor( NULL, IDC_ARROW ),
        // memory related stuff
        UINT      cbSize      = sizeof(WNDCLASSEX),
        int       cbWinExtra  = 0,
        int       cbClsExtra  = 0 )
        : // Initialization List
        wndClassEx_.hInstance( hInstance ), // <--- here ??
        wndClassEx_.lpfnWinProc( lpfnWinProc ),
        wndClassEx_.lpszMenuName( lpszMenuName ),
        wndClassEx_.lpszClassName( lpszClassName ),
        wndClassEx_.hIcon( hIcon ),
        wndClassEx_.hIconSm( hIcon ),
        wndClassEx_.style( style ),
        wndClassEx_.hbrBackground( hbrBackground ),
        wndClassEx_.hCursor( hCursor ),
        wndClassEx_.cbSize( cbSize ),
        wndCLassEx_.cbWinExtra( cbWinExtra ),
        wndClassEx_.cbClsExtra( cbClsExtra )
    { /* c'tor body empty */ }


    // ... i think the below part doesn't matter 
Last edited on
You cannot initialize inner members.
You must assign their value one by one in the ctor body.
oh, i see thanks !!
Uniform initialization http://www.stroustrup.com/C++11FAQ.html#uniform-init

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
struct A { int a ; double b ; const char* c ; };

struct B { unsigned long long x ; A y ; };

struct C
{
    C( const B& bb ) : b(bb) {}

    C( unsigned long long xx, const A& aa ) : b{ xx, aa } {}

    C( int a, double b, const char* c, unsigned long long x )
        : b { x, {a,b,c} } {}

    const B b ;
};
thanks for the new knowledge JLBorges !!
Topic archived. No new replies allowed.