the posted code had numerous errors
here's a re-write the generated the following
output
Loop: 1
Loop: 2
Loop: 3
Loop: 99
Loop: 2001
#define SIZE 5
class Obj {
int member [SIZE] = { 1, 2, 3, 99, 2001 };
public:
Obj () { }
void getval (uint8_t pos) {
Serial.print ("Loop: ");
Serial.println (member[pos]);
}
} myObj;
// -----------------------------------------------------------------------------
void setup (){
Serial.begin (9600);
for (int n = 0; n < SIZE; n++)
myObj.getval (n);
}
void loop () {
}