Article View: alt.comp.lang.learn.c-c++
Article #367Re: Arrays as static members
From: Greg Comeau
Date: Fri, 02 Jul 1999 00:00
Date: Fri, 02 Jul 1999 00:00
24 lines
1814 bytes
1814 bytes
In article <qQQe3.1601$nZ5.3455@nntpserver.swip.net> "Magnus Hult" <hult.holmstrom@swipnet.se> writes:
>I've got a problem (again). Take a look at this:
>
>class Object {
> public:
> int id;
> static Object *pId[50];
>};
>
>How to allocate memory for those 50 static members? I can't make a loop
>outside a function, and it doesn't feel right to write "Object
>*Object::pId[n] = 0;" 50 times.
I guess I don't understand. If you want to define all pId's
you'll need to do some somewhere, either in a brace enclosed
initializer list, or in a loop (perhaps done in a static member function).
- Greg
--
Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418-3214
Producers of Comeau C/C++ 4.2.38 -- New Release! We now do Windows too.
Email: comeau@comeaucomputing.com / Voice:718-945-0009 / Fax:718-441-2310
*** WEB: http://www.comeaucomputing.com ***
Technical Details
Message-ID:
<7liq6o$t5i$1@panix.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<qQQe3.1601$nZ5.3455@nntpserver.swip.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f8d38,aecd7aaa6e14dde4 X-Google-Attributes: gidf8d38,public X-Google-Thread: 114592,aecd7aaa6e14dde4 X-Google-Attributes: gid114592,public X-Google-Thread: 109fba,aecd7aaa6e14dde4 X-Google-Attributes: gid109fba,public From: comeau@panix.com (Greg Comeau) Subject: Re: Arrays as static members Date: 1999/07/02 Message-ID: <7liq6o$t5i$1@panix.com> X-Deja-AN: 496476304 References: <qQQe3.1601$nZ5.3455@nntpserver.swip.net> X-Complaints-To: abuse@panix.com X-Trace: news.panix.com 930933785 11592 166.84.0.226 (2 Jul 1999 16:43:05 GMT) Organization: Comeau Computing; http://www.comeaucomputing.com Reply-To: comeau@comeaucomputing.com NNTP-Posting-Date: 2 Jul 1999 16:43:05 GMT Newsgroups: alt.comp.lang.learn.c-c++,borland.public.cpp.language,comp.lang.c++ X-Newsposter: trn 4.0-test55 (26 Feb 97)