内容へ移動
C++プログラマのためのC++/CLI入門
ユーザ用ツール
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
現在位置:
TOP
»
cli
»
initonly
cli:initonly
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
{{indexmenu_n>23}} ====== initonly ====== initonlyで宣言されたメンバはコンストラクタでのみ値を設定できます。initonly staticで宣言されたメンバはstaticコンストラクタのみ値を設定できます。 <code cpp> ref class C { public: initonly static int x; initonly static int y; initonly int z; static C() { x = 1; y = 2; // z = 3; // Error } C() { // A = 2; // Error z = 3; } void sfunc() { // x = 5; // Error // z = 5; // Error } }; int main() { System::Console::WriteLine(C::x); System::Console::WriteLine(C::y); C c; System::Console::WriteLine(c.z); return 0; } </code>
/var/www/html/virtual/cppcli/data/pages/cli/initonly.txt
· 最終更新: 2013/12/23 09:08 (外部編集)
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
文書の先頭へ