static initialization of array members?

Discussion in 'C++' started by Peter Olcott, May 31, 2006.

  1. Peter Olcott

    Peter Olcott Guest

    Is this possible in C++ ???
    Peter Olcott, May 31, 2006
    #1
    1. Advertising

  2. Peter Olcott wrote:
    > Is this possible in C++ ???


    Please, don't write parts of your question in your subject. Make sure
    everything is in your post.

    Of course it is possible to initialize static array members, it is even
    mandatory.

    class C
    {
    public:
    static int a[10];
    };

    int C::a[10] = {1, 2, 3};


    Jonathan
    Jonathan Mcdougall, May 31, 2006
    #2
    1. Advertising

  3. Peter Olcott

    mlimber Guest

    mlimber, May 31, 2006
    #3
  4. Peter Olcott

    mlimber Guest

    Jonathan Mcdougall wrote:
    > Peter Olcott wrote:
    > > Is this possible in C++ ???

    >
    > Please, don't write parts of your question in your subject. Make sure
    > everything is in your post.
    >
    > Of course it is possible to initialize static array members, it is even
    > mandatory.


    I think he meant statically initializing arrays that are members.

    Cheers! --M
    mlimber, May 31, 2006
    #4
  5. Peter Olcott

    Peter Olcott Guest

    "Jonathan Mcdougall" <> wrote in message
    news:...
    > Peter Olcott wrote:
    >> Is this possible in C++ ???

    >
    > Please, don't write parts of your question in your subject. Make sure
    > everything is in your post.
    >
    > Of course it is possible to initialize static array members, it is even
    > mandatory.
    >
    > class C
    > {
    > public:
    > static int a[10];
    > };
    >
    > int C::a[10] = {1, 2, 3};
    >
    >
    > Jonathan
    >


    Thanks that did it!
    Peter Olcott, May 31, 2006
    #5
    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. JFCM
    Replies:
    4
    Views:
    5,723
  2. Victor Bazarov
    Replies:
    2
    Views:
    392
    red floyd
    Aug 1, 2003
  3. DanielBradley
    Replies:
    3
    Views:
    14,906
    Dave Moore
    Jun 2, 2004
  4. Bret Pehrson
    Replies:
    4
    Views:
    497
    Bret Pehrson
    Dec 9, 2004
  5. BigMan
    Replies:
    7
    Views:
    468
    Axter
    Mar 1, 2005
Loading...

Share This Page