470,855 Members | 1,154 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,855 developers. It's quick & easy.

static initialization of array members?

Is this possible in C++ ???
May 31 '06 #1
4 10005
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

May 31 '06 #2
Peter Olcott wrote:
Is this possible in C++ ???


No, unless your member is static. You can with std::vectors, however:

http://groups.google.com/group/comp....fe5982913d4414

Cheers! --M

May 31 '06 #3
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

May 31 '06 #4

"Jonathan Mcdougall" <jo***************@gmail.com> wrote in message
news:11**********************@h76g2000cwa.googlegr oups.com...
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!
May 31 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Luther Baker | last post: by
5 posts views Thread by Jim Langston | last post: by
1 post views Thread by Piotr Sawuk | last post: by
8 posts views Thread by Per Bull Holmen | last post: by
10 posts views Thread by n.torrey.pines | last post: by
20 posts views Thread by JohnQ | last post: by
2 posts views Thread by Ranganath | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.