Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!apple!amb From: amb@Apple.COM (A. Michael Burbidge) Newsgroups: comp.lang.c++ Subject: Re: const in a class Message-ID: <54021@apple.Apple.COM> Date: 15 Jun 91 02:14:28 GMT References: <1991Jun15.014436.10060@kcbbs.gen.nz> Distribution: comp Organization: Apple Computer Inc., Cupertino, CA Lines: 35 In article , glenn@bitstream.com (Glenn P. Parker) writes: > In article <1991Jun15.014436.10060@kcbbs.gen.nz> Chris_Sullivan@kcbbs.gen.nz (Chris Sullivan) writes: > > class C { > > const int size = 1000; > > char array[size]; > > ... > > } > > This is a hack, but it has been suggested by greater authorities than me! > > class C { > enum { size = 1000 }; > char array[size]; > // ... > }; > > -- > Glenn P. Parker glenn@bitstream.com Bitstream, Inc. > uunet!huxley!glenn 215 First Street > BIX: parker Cambridge, MA 02142-1270 This following seems to work for our AT&T 2.0 derived compiler: class C { static const int size; char array[size]; // ... }; and then in the implementation file give the definition: const int C::size = 1000; Mike Burbidge MacApp Engineering