Class pointer Array

I have some statements that compile perfectly but a variant that results in a compilation error.

The following is just fine

MyClass class1;
MyClass class2;
MyClass* classPointers[] = {&class1, &class2};

but this

MyClass class1;
MyClass class2;
MyClass* classPointers[] = {NULL, NULL};
classPointers[0] = &class1;

results in "classPointers' does not name a type"

as does

MyClass class1;
MyClass class2;
MyClass *classPointers[2];
classPointers[0] = &class1;

Can anyone help me with an explanation?

A "show all your code" type of thing?

class MyClass {};

MyClass class1;
MyClass class2;
MyClass* classPointers[] = {NULL, NULL};

void setup() {
  classPointers[0] = &class1;
}
void loop() {}

Compiles without errors, like expected.

Well I suppose that makes sense. It was the nature of the error message that bemused me.
Thanks for the input