ユーザ用ツール

サイト用ツール


cli:indexed_property

差分

この文書の現在のバージョンと選択したバージョンの差分を表示します。

この比較画面にリンクする

cli:indexed_property [2009/02/03 07:19]
admin
cli:indexed_property [2013/12/23 09:08]
ライン 1: ライン 1:
-{{indexmenu_n>​18}} 
-====== indexed property ====== 
  
- 
-indexed propertyはC++のoperator[]のようなものです。 
-<code cpp> 
-ref class C { 
-    array<​double>​^ d; 
-public: 
-    C() { 
-        d = gcnew array<​double>​(10);​ 
-    } 
-    property double default[int] 
-    { 
-        double get(int i) { return d[i]; } 
-        void   ​set(int i, double t) { d[i] = t; } 
-    } 
-}; 
-int main() 
-{ 
-    C c; 
-    c[5] = 5; 
-    double d = c[5]; 
-} 
-</​code>​ 
-propertyにgetメソッドを定義しなければ、書き込みオンリーにすることもできます。 ​ 



/var/www/html/virtual/cppcli/data/pages/cli/indexed_property.txt · 最終更新: 2013/12/23 09:08 (外部編集)