17日目 動的配列をデフォルトプロパティにしてアクセスを簡単にしようと試みる

エラーがでないのでいけるかなと思ったけどやっぱり無理

type
TStageScore = Record
private

FTileCount        : Integer;

FWordPoint        : Integer;
FItemPoint        : Integer;

FIsCleared        : Boolean;
FIsOnTime         : Boolean;
FIsNoDeleteItem   : Boolean;
FIsNoUndo         : Boolean;
FDoubleUpItemCount: Integer;

FIsStageFinished  : Boolean;

function getStageScore: Integer;
function getBasicPoint: Integer;

public

CompleteWordArray: TWordArray;

procedure Init(aTileCount: Integer);
procedure Assign(aStageScore: TStageScore);

// 受信系
procedure AddCompleteWord(aWord: String);
procedure AddItemPoint(aPoint: Integer);
procedure ClearedStage(aTimePoint: Integer);
procedure GiveUpStage(aTimePoint: Integer);
procedure BreakMoDeteteItem();
procedure BreakNoUnDo();
procedure UseDoubleUpItem();

Property WordPoint        : Integer read FWordPoint;
Property ItemPoint        : Integer read FItemPoint;
Property TileCount        : Integer read FTileCount;
Property IsCleared        : Boolean read FIsCleared;
Property IsOnTimet        : Boolean read FIsOnTime;
Property IsNoDeleteItem   : Boolean read FIsNoDeleteItem;
Property IsNoUndo         : Boolean read FIsNoUndo;
Property DoubleUpItemCount: Integer read FDoubleUpItemCount;
Property IsStageFinished  : Boolean read FIsStageFinished;

Property BasicPoint       : Integer read getBasicPoint;
Property StageScore       : Integer read getStageScore;

end;

type
TGameScore = record
private
//  FItems: array of TStageScore;
function getItem(aIndex: Integer): TStageScore;
procedure setItem(aIndex: Integer; const Value: TStageScore);
public
FItems: array of TStageScore;
// 初期化
procedure Init();
procedure Assign(aGameScore: TGameScore);

function AverageScore(): Single;
function AverageWordLength(): Single;
function CountWhereWordLengthIs(aWordLength: Integer): Integer;

function GameScore(): Integer;

Property Items[aIndex: Integer]: TStageScore read getItem write setItem; default;

end;

修正後
FItems を public にした

type
TGameScore = record
private
public
Items: array of TStageScore;
// 初期化
procedure Init();
procedure Assign(aGameScore: TGameScore);

function AverageScore(): Single;
function AverageWordLength(): Single;
function CountWhereWordLengthIs(aWordLength: Integer): Integer;

function GameScore(): Integer;

end;

コメントを残す

メールアドレスが公開されることはありません。


× 6 = 三十 六

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>