Вниз
Скачать: 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 вся ветка

Скачать: CL | DM;



Память: 0.46 MB
Время: 0.008 c
8-88968
MZ
2002-01-19 11:58
2002.06.27
Есть звуковой файл нестандартного вида как его проиграть?


3-88700
yozhik
2002-05-30 15:16
2002.06.27
Сжатие базы Access


6-88972
Hammer
2002-04-18 09:13
2002.06.27
Мастера, помогите


4-89082
anod
2002-04-28 00:13
2002.06.27
RegisterHotKey


1-88953
Ubermensch
2002-06-15 22:10
2002.06.27
Защита доступа к памяти




   Наверх