Original Post
I have two .cpp files (File1.cpp and File2.cpp) each containing a class, let''s say Class A and Class B.
Now Class A in File1.cpp is the base class and Class B in File2.cpp is derived from it.
In File1.cpp (Not part of Class A!) I have static ClassA* g_ClassAPointer = NULL. By my reckoning I am saying ClassA is static and I have the pointer variable ClassAPointer set to NULL. So ClassAPointer is a global variable with scope only for File1.cpp meaning File2.cpp cannot see ClassAPointer.
Then in ClassA''s constructor I have g_ClassAPointer = this. So now g_ClassAPointer contains the memory address of File1.cpp thus ClassA (I''m lost here I think!!).
I can then use g_ClassAPointer like, g_ClassAPointer->ClassA Member Function.
So in essence I am hiding and protecting the global pointer g_ClassAPointer from Class B and File2.cpp.
g_ClassAPointer''s reason for existence is to work witbin another global function inside File1.cpp. It is used like, return g_ClassAPointer->ClassA_Member_function.
If anyone out there has just read this and can decipher it (it is English, honest), and can help out I would really appreciate it.