www.delorie.com/archives/browse.cgi | search |
From: | "Campbell, Rolf [SKY:1U32:EXCH]" <cp1v45 AT NortelNetworks DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: c++ const definition in djgpp 2.95 problem |
Date: | Mon, 23 Aug 1999 15:43:58 -0400 |
Organization: | Nortel Networks |
Lines: | 28 |
Message-ID: | <37C1A47D.40442E34@NortelNetworks.com> |
References: | <37c18ffb DOT 1378453 AT news DOT kfunigraz DOT ac DOT at> |
NNTP-Posting-Host: | bmerhc00.ca.nortel.com |
Mime-Version: | 1.0 |
X-Mailer: | Mozilla 4.7 [en] (X11; I; HP-UX B.10.20 9000/712) |
X-Accept-Language: | en |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
mimo wrote: > i used to define my constants like this, following advice by someone > who seemed to understand the ansi/iso c++ declaration: > > class c{ > > const char cszText[] = "Text"; > const int ciNumber = 5; Why would you want to have constant member variables? I think you should be using constant static member variables. class c { static const char cszText[]; }; const char c::cszText[] = "Text"; I haven't tested that, and it might not work. You might have to use 'char *' instead of 'char []' but that shouldn't make any difference if they are constants. -- -Rolf Campbell (39)3-6318
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |