Are you sure that you need to use C ++ CLI here? There are some problems with global controlled variables. In ordinary C ++, creating and initializing an array can be written much easier:
class card { public: int suit, number; }; card mass[9]={0};
If you need to create it in dynamic memory, then you must either make a default null constructor, or reset it yourself in a loop.
Generally, globals are a bad thing. Using them is a bad programming tone. It is better to use only global constants.
Reply to the first comment:
So far, not quite imagine how to write applications without using global variables.
You must pass variables to functions or use classes. For example, it is often possible to logically combine into a class one or more global variables and functions that work with them.
The fact of the matter is that I pretty well know the usual C ++, and when switching to Visual C ++ I encountered such a problem.
It seems to me that you confuse the terms. Visual C ++ is just a development environment. C++\CLI you use is an extension of the Microsoft language. It can not be used and written in ordinary C ++. You can easily mix regular and advanced C ++. Then you can make this class as before, and where it gives an advantage, use advanced features. In fact, C++\CLI intended only for communicating unmanaged code with managed code, which, for example, is written in C # or VB .NET. Simply writing programs on it is not recommended.
I'm used to writing console applications, but everything is simple, exactly as you wrote.
That is, do you think that using C++\CLI with Windows Forms is the only way to write window applications in C ++ ?! For regular C ++, there are a bunch of libraries, for example, MFC, QT. Finally, you can write on a pure Windows API by connecting <windows.h>. I believe that window applications are best written on C # with Windows Forms. C # is, by its capabilities, equivalent to C++\CLI extensions, but its syntax is much simpler and more similar to regular C ++.