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

Вниз

Списки   Найти похожие ветки 

 
Nameziz   (2008-11-05 12:05) [0]

Хочу написать свой класс-список, TIntList (большинство методов будут как и в TStringList, только для работы с целыми числами). Вопрос от какого класса наследоваться?


 
Сергей М. ©   (2008-11-05 12:08) [1]

Например, от TList


 
Palladin ©   (2008-11-05 12:22) [2]

Type
TIntList=Class
 Private
  m_theList:TList;

  Function lcGetCount:Integer;
  Function lcGetItem(p_nIndex:Integer):Integer;
  Procedure lcSetItem(p_nIndex,p_nValue:Integer);
 Public
  Constructor Create;
  Destructor Destroy; Override;

  Property Count:Integer Read lcGetCount;
  Property Items[nIndex:Integer]:Integer Read lcGetItem Write lcSetItem; Default;
  Procedure Add(p_nData:Integer);
  Procedure Delete(p_nIndex:Integer);
  Procedure Clear;
End;

Constructor TIntList.Create;
Begin
 m_theList:=TList.Create;
End;

Destructor TIntList.Destroy;
Begin
 m_theList.Free;
End;

Function TIntList.lcGetCount;
Begin
 Result:=m_theList.Count;
End;

Procedure TIntList.Add;
Begin
 m_theList.Add(Pointer(p_nData));
End;

Procedure TIntList.lcSetItem;
Begin
 m_theList[p_nIndex]:=Pointer(p_nValue);
End;

Procedure TIntList.Delete;
Begin
 m_theList.Delete(p_nIndex);
End;

Function TIntList.lcGetItem;
Begin
 Result:=Integer(m_theList[p_nIndex]);
End;

Procedure TIntList.Clear;
Begin
 m_theList.Clear;
End;


 
Anatoly Podgoretsky ©   (2008-11-05 12:27) [3]


> Например, от TList

Не например, а именно от него, если конечно недостаточно возможностей TList


 
Nameziz   (2008-11-05 12:44) [4]

Спасибо всем



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

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

Наверх




Память: 0.47 MB
Время: 0.013 c
3-1210838639
grav
2008-05-15 12:03
2008.12.14
Упорядочение по возрастанию в IBTable


2-1225965108
Саня
2008-11-06 12:51
2008.12.14
Генерация чисел


2-1226049431
Denis__
2008-11-07 12:17
2008.12.14
GetTickCount в Turbo Pascal 7.0


2-1225530092
Проходящий
2008-11-01 12:01
2008.12.14
Использование агр.ф-ций на временных таблицах в IB


2-1225904136
TRSteep
2008-11-05 19:55
2008.12.14
Алгоритм Blowfish