If you do not want the array to be public, you could return a reference to the array.
This gives you the ability to access the array, or reference the array someplace else:
class Foo{
public:
int (&getArray())[2]{
return id;
}
private:
int id[2];
};
void setup() {
Foo foo;
//Write to internal array
foo.getArray()[0] = 4;
//Read from internal array
Serial.print( foo.getArray()[0] );
//Reference the array.
int (&ref)[2] = foo.getArray();
//Use referenced array
ref[0] = 1;
}
void loop() {}
EDIT: ...Oops, fixed code...