{"name":"Array+=","title":"Array+=","type":"topic","url":"https://community.bistudio.com/wiki/Array%2B%3D","revid":373440,"updated":"2025-05-08T11:27:12Z","aliases":[],"markdown":"Arma 3 v0.50 same-file support\nArma 3 v1.00 full support\n\nThe `array[] += {}` syntax allows to add items to an existing array inherited from the direct parent.\n\n> [!IMPORTANT]\n> - This syntax has limitations in inheritance - see Limitations.\n> - This syntax should **not** be used in Description.ext - only in modded config.cpp.\n\n### Usage\n\n```cpp\nclass A\n{\n    array[] = { any, thing };\n};\n\nclass B : A\n{\n    array += { more, Bstuff };\n};\n\nclass C : A // inherits from A, -not- B\n{\n    array += { other, Cstuff };\n};\n```\n\n### Limitations\n\nOnly **direct inheritance** of an explicitly-stated array works. The following cases do **not** work:\n\n|  |  |\n|---|---|\n| ```cpp<br>class A { array[] = { any, thing }; };<br>class B : A {};<br>class C : B // inherits from B which inherits from A (without changes)<br>{<br>    array[] += { wont, work }; // result: array[] = { wont, work };<br>};<br>``` | ```cpp<br>class A { array[] = { any, thing }; };<br>class B : A { array[] += { more, stuff }; };<br>class C : B // inherits from B which inherits from A (with += changes)<br>{<br>    array[] += { wont, work }; // result: array[] = { wont, work };<br>};<br>``` |","sections":[{"heading":null,"level":1,"markdown":"Arma 3 v0.50 same-file support\nArma 3 v1.00 full support\n\nThe `array[] += {}` syntax allows to add items to an existing array inherited from the direct parent.\n\n> [!IMPORTANT]\n> - This syntax has limitations in inheritance - see Limitations.\n> - This syntax should **not** be used in Description.ext - only in modded config.cpp."},{"heading":"Usage","level":3,"markdown":"```cpp\nclass A\n{\n    array[] = { any, thing };\n};\n\nclass B : A\n{\n    array += { more, Bstuff };\n};\n\nclass C : A // inherits from A, -not- B\n{\n    array += { other, Cstuff };\n};\n```"},{"heading":"Limitations","level":3,"markdown":"Only **direct inheritance** of an explicitly-stated array works. The following cases do **not** work:\n\n|  |  |\n|---|---|\n| ```cpp<br>class A { array[] = { any, thing }; };<br>class B : A {};<br>class C : B // inherits from B which inherits from A (without changes)<br>{<br>    array[] += { wont, work }; // result: array[] = { wont, work };<br>};<br>``` | ```cpp<br>class A { array[] = { any, thing }; };<br>class B : A { array[] += { more, stuff }; };<br>class C : B // inherits from B which inherits from A (with += changes)<br>{<br>    array[] += { wont, work }; // result: array[] = { wont, work };<br>};<br>``` |"}],"categories":["Introduced with Arma 3 version 0.50","Introduced with Arma 3 version 1.00","Real Virtuality File Formats"],"groups":["Tools and File Formats"]}