Article View: alt.comp.lang.learn.c-c++
Article #361Re: Arrays as static members
From: Jim Gewin
Date: Thu, 01 Jul 1999 00:00
Date: Thu, 01 Jul 1999 00:00
18 lines
1426 bytes
1426 bytes
Magnus Hult wrote:
>
> Hello,
>
> 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.
>
Perhaps: put the loop into a constructor and a loop
to destroy the array in the destructor?
Technical Details
Message-ID:
<377C0B28.414CD2A1@worldnet.att.net>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: Jim Gewin <jgewin@worldnet.att.net> Subject: Re: Arrays as static members Date: 1999/07/01 Message-ID: <377C0B28.414CD2A1@worldnet.att.net> X-Deja-AN: 496377399 Content-Transfer-Encoding: 7bit References: <qQQe3.1601$nZ5.3455@nntpserver.swip.net> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc02.worldnet.att.net 930914225 15417 12.77.159.219 (2 Jul 1999 11:17:05 GMT) Organization: AT&T WorldNet Services Mime-Version: 1.0 Reply-To: jgewin@worldnet.att.net NNTP-Posting-Date: 2 Jul 1999 11:17:05 GMT Newsgroups: alt.comp.lang.learn.c-c++,borland.public.cpp.language,comp.lang.c++