program Projekt_12;
{$APPTYPE CONSOLE}
uses
  SysUtils;

type
  TStudent = class
    private
      FName: array[1..4] of String;
      function GetName(i: Integer): String;
      procedure SetName(i: Integer; names: String);
    public
      // deklaracja konstruktora
      constructor Create;
      // deklaracja wlasnosci tablicowej
      property Name[i: Integer]: String read GetName
                                        write SetName;
  end;
//---------------------------------------------------------
function TStudent.GetName(i: Integer): String;
  begin
    Result:=FName[i];
  end;
//---------------------------------------------------------
procedure TStudent.SetName(i: Integer; names: String);
  begin
    FName[i]:=names;
  end;
//---------------------------------------------------------
constructor TStudent.Create;
begin
  // opcjonalnie cialo konstruktora
end;
//---------------------------------------------------------
var
  Student: TStudent;
  i: Integer;
begin
  Student:=TStudent.Create;

  // wywoluje Student.SetName
  Student.Name[1]:='Wacek Jankowski';
  Student.Name[2]:='Janek Wackowski';
  Student.Name[3]:='Jola Łobuzińska';

  // wywoluje Student.GetName
  for i:=1 to 3 do
    Writeln(Student.Name[i]);

  ReadLN;
  Student.Free;
end.


