こんな
#ifndef PCH_H
#define PCH_H
// プリコンパイルするヘッダーをここに追加します
ref class class1 {
public:
float s1 = 0.4;
};
ref class class2 {
public:
float s2 = 2.8;
};
value struct class100 {
public:
static class1^ const ins1 = gcnew class1{}; //フィールドで
private:
static class2^ const m_ins2 = gcnew class2{};
public:
static property class2^ ins2 //プロパティで
{
class2^ get() { return m_ins2; }
}
};
#endif //PCH_H
#include "pch.h"
#include <iostream>
using namespace System;
void print()
{
std::wcout << L"ins1.s1=" << class100::ins1->s1 << L"\tins2.s2=" << class100::ins2->s2 << std::endl;
}
int main(array<System::String^>^ args)
{
print();
class100::ins1->s1 = -1.234;
class100::ins2->s2 *= 1e10;
print();
return 0;
}