delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/11/11:49:51

Message-ID: <37B05611.F88183AB@geocities.com>
From: Sahab Yazdani <beyonder69 AT geocities DOT com>
X-Mailer: Mozilla 4.51 [en] (Win98; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: static class members
Date: Tue, 10 Aug 1999 12:40:49 -0400
NNTP-Posting-Host: 209.5.18.105
X-Complaints-To: abuse AT sprint DOT ca
X-Trace: newscontent-01.sprint.ca 934303258 209.5.18.105 (Tue, 10 Aug 1999 12:40:58 EDT)
NNTP-Posting-Date: Tue, 10 Aug 1999 12:40:58 EDT
Organization: Sprint Canada Inc.
Lines: 20
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

why is it that my static class members are not accessable by other
non-static class members.  It compiles fine but then gives me an linker
error.

ie.

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019