|
-
July 9th, 2002, 07:45 AM
#1
static
I have a class say ,c_test
like this
class Test
{
Test()
{
m_pCycleBuffer = &Buffer// a valid value;
}
inline CycleBuffer& GetCycleBuffer() { return *m_pCycleBuffer; }
protected:
static CycleBuffer* m_pCycleBuffer;
}
In the constructor of this class Iam setting "m_pCycleBuffer" to some value.
Iam creating 2 instances of this class Test in 2 different places.
With the first instance when I call "GetCycleBuffer()", it returns me with the value already set in the pointer.
But when I call the "GetCycleBuffer()" with the 2nd instance ,it returns me 0.(It is declared as a static variable)
Why is this so?
Could any one help?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|