cplusplus.com
C++ : Forum : Beginners : Question regarding static pointers as cl
 
cplusplus.com
Information
Documentation
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs


question Question regarding static pointers as class members

cppuser (73)
Hi all,
I have a class MyClass with one static pointer :

.h :
static SomeOtherClass *test;

.cpp :

SomeOtherClass MyClass::*test= 0;


But when I try to access this static pointer from some other class,
I get a couple of errors :

C:/Documents and Settings/USER/Desktop/workspace/MyProject/someclass.cpp:213: undefined reference to `MyClass::test'

Any ideas where might be the problem ?
cppuser (73)
p.s. :
I'm using another static variable, but it's not a pointer to class and it's not giving any troubles.
Chewbob (95)
SomeOtherClass *myClass::test = 0;
cppuser (73)
Ah, yes... I sometimes hate this syntax. :)

Regards
Topic archived. No new replies allowed.