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

Вниз

Очередная несложная разминка для начинающих ;)   Найти похожие ветки 

 
MBo ©   (2002-05-24 12:03) [0]

Найти ошибку в реализации класса списка целых чисел
Предложить методы исправления.


TIntList=class(TList)
private
procedure SetInt(Index:Integer;Value:Integer);
function GetInt(Index:Integer):Integer;
public
property Items [index:Integer]:Integer read GetInt write SetInt; default;
procedure Add(Value:Integer);
end;

implementation

procedure TIntList.SetInt(Index:Integer;Value:Integer);
begin
inherited Items[Index]:=@Value;
end;

function TIntList.GetInt(Index: Integer): Integer;
begin
Result:=PInteger(inherited Items[Index])^;
end;

procedure TIntList.Add(Value:Integer);
begin
inherited Add( @Value);
end;



 
Виктор Щербаков ©   (2002-05-24 12:07) [1]

:-)))


 
MBo ©   (2002-05-24 12:12) [2]

>Виктор Щербаков
Реально встретилось, там еще кое-что было ;)


 
Alx2 ©   (2002-05-24 12:17) [3]

@Value - адрес в стэке :)


 
Кулюкин Олег ©   (2002-05-24 12:20) [4]

:))))))


 
MBo ©   (2002-05-24 12:23) [5]

>Alx2
на самом деле SetInt так и было, а Add так:
procedure TIntList.Add( VAR Value:Integer);


 
Alx2 ©   (2002-05-24 12:37) [6]

Борис, откуда выкопал этот "смелый" подход?


 
MBo ©   (2002-05-24 12:50) [7]

>Alx2
Спросили, почему компилируется, но не вполне работает ;)


 
Tonie ©   (2002-05-24 13:17) [8]

Класс %)))))



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

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

Наверх




Память: 0.48 MB
Время: 0.013 c
14-89021
keymaster
2002-05-03 20:51
2002.06.27
Форум по VCL


3-88730
Explorer
2002-06-03 15:09
2002.06.27
Процедуры в MSSQL 2000


7-89058
oblom
2002-03-08 23:23
2002.06.27
Работа с LPT


4-89071
Eugene_Jek_Efimochkin
2002-04-28 22:26
2002.06.27
---|Ветка была без названия|---


1-88804
Alexander_D6_XP
2002-06-16 15:49
2002.06.27
Динамическая форма