Quantcast
Channel: CodeGuru Forums - C++ and WinAPI
Viewing all articles
Browse latest Browse all 583

scoping?

$
0
0
what is this please ?
the part I don't understand I commented out ...

Code:

class WinException
{
public:
    WinException (char* msg)
                : _err (GetLastError()), _msg(msg) // what trick is this? the : ??
    {}
    DWORD GetError()
                const { return _err; }

    char* GetMessage ()
                const { return _msg; }  // what is constant here? the return value?
private:
    DWORD _err;
    char* _msg;
};

and here too..but this time not on the constructor but on the class itself...I guess this is a c++ trick..

Code:

class WindowClass : public WNDCLASSEX // here ?
{
public:
    WindowClass (WNDPROC WndProc, char const * className, HINSTANCE hInst);
    void Register ()
    {
        if (RegisterClassEx (this) == 0)
            throw WinException ("RegisterClassEx");
    }
};

I understand a class has been made to create a window objects of type WNDCLASSEX.. but that trick there I don't understand...


what does it mean if the scope operator is used in a function like this? does it creates a sort of namespace or something?
[CODE]
void Show ( int nCmdShow )
{
::ShowWindow ( _hwnd, nCmdShow );
::UpdateWindow ( _hwnd );
}
[CODE/]

Viewing all articles
Browse latest Browse all 583

Trending Articles