• Advertisement
Sign in to follow this  

static pointer in subclass not getting resolved?

This topic is 2360 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

if i try to do something like this, it gets compiled allready, but the linker bugs me about pB not being resolved ... ???
what im trying to do is store a pointer to b which is known in all instances of B, especially in b itself!


class A {
class B {
public:
static B* pB;
}
B b[2];
void f();
}

A::B* A::B::pB = NULL;

A::f() {
B::pB = b;
}

Share this post


Link to post
Share on other sites
Advertisement
Your code doesn't compile, and when fixed to compile, it does link. Post the actual code that's giving you the problems.

Share this post


Link to post
Share on other sites
never mind, i already rewrote that part avoiding the use of a static pointer alltogether, but still thanks for the trouble!
(btw what needed to be fixed in the sample code above?)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement