home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / Chip_2000-02_cd.bin / zkuste / Delphi / navody / tt / objvm.exe / UNITS / PtrStack.pas < prev    next >
Pascal/Delphi Source File  |  1998-03-15  |  628b  |  30 lines

  1. unit PtrStack;
  2.  
  3. interface
  4. uses Classes;
  5. type TPtrStack=class(TList)
  6.         procedure Push(a:pointer);
  7.         function  Pop:pointer;
  8.         function  Top:pointer;
  9.         function  IsEmpty:boolean;
  10.      end;
  11. implementation
  12. procedure TPtrStack.Push;
  13.           begin
  14.             Add(a);
  15.           end;
  16. function  TPtrStack.Pop;
  17.           begin
  18.             Result:=Top;
  19.             Delete(Count-1);
  20.           end;
  21. function  TPtrStack.Top;
  22.           begin
  23.             Result:=Items[Count-1];
  24.           end;
  25. function  TPtrStack.IsEmpty;
  26.           begin
  27.             Result:=Count=0;
  28.           end;
  29. end.
  30.