value class demo
#include "stdafx.h" value class MyClass { private: array<double>^ pos; // declare the managed array unsigned int a; unsigned int b; public: void Initialize() { } }; void main(void) { int n_atoms = 50; array<MyClass>^ atoms = gcnew array<MyClass>(n_atoms); for (int i = 0; i < n_atoms; i++) { atoms[i].Initialize( /* ... */ ); } }