using of "static const" in class with no imediately init

Discussion in 'C++' started by heinquoi, May 10, 2004.

  1. heinquoi

    heinquoi Guest

    hello,

    i have the code:
    class window
    {
    static const HWND hWnd;
    static const HINSTANCE hInst;
    // ... next code here
    window (HINSTANCE );
    }
    window::window ( HINSTANCE hInstance )
    {
    // and i try to definie the hInst
    hInst (hInstance);
    // next code here
    }
    But that not accepted for my compiler intel 8.0
    How i can initialize a static const data in my code, but not immédiately and
    in a fonction.
    thank you for your response.
    HEINQUOI
     
    heinquoi, May 10, 2004
    #1
    1. Advertising

  2. "heinquoi" <nospam*> schrieb im Newsbeitrag
    news:409f6402$0$27685$...
    > hello,
    >
    > i have the code:
    > class window
    > {
    > static const HWND hWnd;
    > static const HINSTANCE hInst;
    > // ... next code here
    > window (HINSTANCE );
    > }
    > window::window ( HINSTANCE hInstance )
    > {
    > // and i try to definie the hInst
    > hInst (hInstance);
    > // next code here
    > }
    > But that not accepted for my compiler intel 8.0
    > How i can initialize a static const data in my code, but not

    immediately and
    > in a fonction.



    use const HWND hwnd = ... or leave the const off. You cannot assign
    any "const" variable a value other than on creation of it.
    Make your variable private, so nothing can alter it from outside.

    --
    -Gernot
    int main(int argc, char** argv) {printf
    ("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}

    ________________________________________
    Looking for a good game? Do it yourself!
    GLBasic - you can do
    www.GLBasic.com
     
    Gernot Frisch, May 10, 2004
    #2
    1. Advertising

  3. heinquoi

    heinquoi Guest

    "Gernot Frisch" <> a écrit dans le message de
    news:...
    >
    > use const HWND hwnd = ... or leave the const off. You cannot assign
    > any "const" variable a value other than on creation of it.
    > Make your variable private, so nothing can alter it from outside.


    thank for your answer
    Heinquoi
     
    heinquoi, May 10, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rakesh Sinha
    Replies:
    4
    Views:
    1,876
    Rakesh Sinha
    Jan 13, 2005
  2. Dave
    Replies:
    10
    Views:
    35,392
    Ron Natalie
    May 22, 2005
  3. er
    Replies:
    3
    Views:
    402
  4. news.aon.at
    Replies:
    11
    Views:
    673
    Ian Collins
    Jan 29, 2011
  5. divya
    Replies:
    7
    Views:
    322
    divya
    May 26, 2010
Loading...

Share This Page