値型
C#におけるstructとenumですが、C++/CLIではvalue class/structとenum class/structになっています。C++ではstruct/classの違いはデフォルトのアクセスがpublicなのかprivateかの違いだけなんですが、列挙型でprivateにされても困るのでenum classもenum structも同じ意味になってしまっているよーです。ちょっと引っかかるけど、しゃーないよなぁ。(^^;
// 値型 value struct Rect { int x; int y; int width; int height; Rect (int x, int y, int width, int height) : x(x), y(y), width(width), height(height) {} // 以下は定義できない // Rect () {} // ~Rect() {} // !Rect() {} }; // 列挙型 // enum classでもenum structでも同じ enum class Color { Red, Green, Blue, }; // 型も指定できる enum struct State : short { Start = 0x01, Stop, };