delorie.com/archives/browse.cgi | search |
From: | "Campbell, Rolf [SKY:1U32:EXCH]" <cp1v45 AT americasm01 DOT nt DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: static class members |
Date: | Tue, 10 Aug 1999 13:45:44 -0400 |
Organization: | Nortel Networks |
Lines: | 24 |
Message-ID: | <37B06548.D84B1D3@americasm01.nt.com> |
References: | <37B05611 DOT F88183AB AT geocities DOT com> |
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 |
Sahab Yazdani wrote: > class Foo { > private: > static int red; > public: > Foo(); > }; > > Foo::Foo() { > red=0; > } > > this will cause linker error. > Is there anyway to get around this?? WITHOUT moving the data members > out of the class Yes, add a line that says "int Foo::red;" after the class declaration. -- -Rolf Campbell (39)3-6318
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |