Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2006.05.21;
Скачать: CL | DM;

Вниз

Вопроса по record   Найти похожие ветки 

 
Glex ©   (2006-04-17 22:42) [0]

1) type TIntArr =
 Val: array[1..100] of integer;
 Len: integer;
 end;
var A: TIntArr;


Как сделать, чтобы конструкция вида A[i] указывала на A.Val[i]?


 
Glex ©   (2006-04-17 22:43) [1]

type TIntArr = record
Val: array[1..100] of integer;
Len: integer;
end;
var A: TIntArr;


 
Гаврила ©   (2006-04-17 22:48) [2]

НИкак. Это можно сделать только для классов и их свойств, а для записей и их полей нельзя.


 
jack128 ©   (2006-04-18 01:54) [3]

Для Delphi2006 можно:
type
 TIntArr = record
   Val: array[1..100] of integer;
   Len: integer;
 private
   function GetVal(Index: Integer): Integer;
   procedure SetVal(Index: Integer; const Value: Integer);
 public
   property Values[Index: Integer]: Integer read GetVal write SetVal; default;
 end;

{ TIntArr }

function TIntArr.GetVal(Index: Integer): Integer;
begin
 Result := Val[Index];
end;

procedure TIntArr.SetVal(Index: Integer; const Value: Integer);
begin
 Val[Index] := Value;
end;

procedure TForm7.FormCreate(Sender: TObject);
var
 Arr: TIntArr;
begin
 Arr[10] := 20;
 ShowMessage(IntToStr(Arr.Val[10]));
end;


 
Glex ©   (2006-05-02 00:15) [4]

Спасибо!



Страницы: 1 вся ветка

Текущий архив: 2006.05.21;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.055 c
3-1143191600
kley
2006-03-24 12:13
2006.05.21
замена нулей


2-1146238797
Khim
2006-04-28 19:39
2006.05.21
почтовой клиент, ошибка: Authentication falled


15-1145639828
ArtemESC
2006-04-21 21:17
2006.05.21
как обновить содержимое браузера с помощью PHP?


2-1146490417
Black Demon Night
2006-05-01 17:33
2006.05.21
Шаг в цикле For


4-1140881371
Pit
2006-02-25 18:29
2006.05.21
My Computer