掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
Propertyとアクセサメソッド (ID:24524)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
以下についてみなさんどう思われます? 1.【直接変数を読む場合】 type Thoge = class private FX:Integer; public Property X:Intetger read FX write FX //直接変数 end; 2.【アクセサメッソドを使用する場合】 Interface type Thoge = class private FX:Integer; procedure SetFX(FX:Integer); function GetFX:Integer; public Property X:Intetger read GetFX write SetFX //直接変数 end; Implementation procedure SetFX(FX:Integer){ self.FX = FX; end; function GetFX:String{ Result := self.FX; end; この2つに何か違いがあると思われますか? 私は、2の必要性がいまいちわかりません。
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.