Array of Objects

Hi All. What’s the preferred method of (statically) defining an array of objects when the class’s constructor takes arguments? The two methods below both compile without errors, but I don’t have access to hardware right now to try them.

Thanks.

myClass objectArray[] = {myClass(1, 2), myClass(3, 4), myClass(5, 6)};
myClass myObject0(1, 2), myObject1(3, 4), myObject2(5, 6);
myClass objectArray[] = {myObject0, myObject1, myObject1};

You can use list initialization:

class myClass {
  public:
    myClass(int n1, int n2) {}
};

myClass objectArray[] = {{1, 2}, {3, 4}, {5, 6}};

void setup() {

}

void loop() {

}

Me likey. Thanks.