why cant extern be used?
Code:
<file: foo.h>
class Foo
{
};
extern Foo bar_array[10]; // note: nothing is defined here.
< some .cpp file >
#include "foo.h"
Foo bar_array[10]; // now bar_array is defined.
... implementations of the methods of Foo go here, which can of course access the bar_array
< some other .cpp file>
#include "foo.h"
int main()
{
bar_array[4] = Foo(); // valid, since bar_array was declared extern in foo.h
return 0;
}
also, when you put your code that way:
Code:
Class myClass {
//never mind constructors and destructors, they aren't relevant here
public:
void SelfRefer();
int Foo;
};
myClass Billy[2];
void myClass::Selfrefer() {
Billy[1].Foo=3;
}
you shouldn't have any problems then.