掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
TListでの二次元配列クラスの作成 (ID:9070)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
type PRec = ^TRecord; TRec = record メンバ end; type TPList = class(TList) //PRecを格納するリスト private function GetP(Index: Integer): PRec; procedure PutP(Index: Integer; const Value: PRec); public property Items[Index : Integer] : PRec Read GetP Write PutP; default; // ↑ ItemsでPRecにアクセスする type TCellList = Class(TList) //TPListを格納するリスト ■クラスの本体 private XList : TPList; public constructor Create; property Items[Index : Integer] : TPList Read Get Write Put; default; // ↑ ItemsでPRecを格納したTPListにアクセスする end; implementation //-------------{ TCellList }----------------- constructor TCellList.Create; var Rec : PRec; X,Y : Integer; begin for X := 0 to 9 do begin XList := TPList.Create; XList.Count := 10; for Y := 0 to 9 do begin new(Rec); Rec^.メンバ := 値; XList.Items[j] := Rec; // (1).ここで(2)のPutPメソッドが実行される end; end; end; procedure TCellList.Put(Index: Integer; const Value: TPList); begin TLA(Self).Items[Index] := Value; end; function TCellList.Get(Index: Integer): TPList; begin Result := inherited Get(Index); end; //-------------{ TPList }----------------- function TPList.GetP(Index: Integer): PRec; begin Result := PLARec(inherited Get(Index)); end; procedure TPList.PutP(Index: Integer; const Value: PRec); begin TPList(Self).Items[Index] := Value; // (2).この文が無限ループになる end;
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.