Note that there are some explanatory texts on larger screens.

plurals
  1. POE2008 Incompatible types on an indexed property declaration in Delphi
    primarykey
    data
    text
    <p>Further to <a href="https://stackoverflow.com/questions/10765722/indexed-property-in-delphi-beginner-is-making-multiple-player-objects-accessib">previous question</a>, When I try to compile this I get the error incompatible type on this line:</p> <pre><code> Property player[i : integer] : TStringList read p; </code></pre> <p>I'm unsure why? Here is whole class:</p> <pre><code>unit Battle; interface uses SysUtils,Dialogs,Classes,inifiles, StdCtrls; type TPlayers = class Private p : array[1..20] of TStringList; FPlaceUnit: Boolean; FTeamCount: Integer; Public Property player[i : integer] : TStringList read p; property PlaceUnit : Boolean read FPlaceUnit write FPlaceUnit; procedure AddPlayer (PlayerNo : integer; player : String); property TeamCount : Integer read FTeamCount write FTeamCount; constructor Create; virtual; End; {Host class} THostPlayers = Class(TPlayers) Private FIsHost: string; Public constructor Create; override; property IsHost : string read FIsHost write FIsHost; End; {Guest Class} TGuestPlayers = Class(TPlayers) Private FIsGuest: string; Public constructor Create; override; property IsGuest : string read FIsGuest write FIsGuest; End; implementation uses main; {constructor} constructor TPlayers.Create; begin p := TStringList.Create; end; constructor THostPlayers.Create; begin inherited; // Calls TPlayers.Create IsHost := 'No'; PlaceUnit := true; TeamCount :=0; end; constructor TGuestPlayers.Create; begin inherited; // Calls TPlayers.Create IsGuest := 'No'; PlaceUnit := true; TeamCount := 0; end; {ADD Player} procedure TPlayers.AddPlayer(PlayerNo : integer; player : String); var CharINI : TIniFile; begin CharINI := Tinifile.Create(thisdir+'\char\charstats.ini'); CharINI.ReadSectionValues(player,player[PlayerNo]); CharINI.Free; end; end. </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload