home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR19 / OBJPROB.ZIP / STACK.PRG < prev    next >
Text File  |  1993-09-24  |  1KB  |  42 lines

  1. /*
  2. ╔═══════════════════════════════════════════════════════════════╗
  3. ║ Módulo: Stack.prg                                             ║
  4. ║ Lenguaje: Clipper 5.0x + ObjectsP                             ║
  5. ║ Fecha: Marzo  1993                                            ║
  6. ║ Compilar: Clipper Stack    /a /n /w                           ║
  7. ║ Desc.:Demo de clases: Stack Class                             ║
  8. ║                                                               ║
  9. ║ (c) 1993 Francisco Pulpón y Antonio Linares                   ║
  10. ╚═══════════════════════════════════════════════════════════════╝
  11. */
  12.  
  13. #include "ObjectsP.ch"
  14.  
  15.  
  16. CLASS Stack
  17.  
  18.     HIDE DATA   aStack  AS  Array
  19.  
  20.     METHOD  New()         INLINE  ::aStack := {}, Self
  21.     METHOD  Push( uVal )  INLINE  aadd( ::aStack, uVal ), uVal
  22.     METHOD  Top()         INLINE  atail( ::aStack )
  23.     METHOD  lEmpty()      INLINE  Empty( ::aStack )
  24.  
  25.     METHOD  Pull
  26.  
  27. ENDCLASS
  28.  
  29.  
  30. METHOD Stack.Pull()
  31.  
  32.     local uRet, aStack := ::aStack
  33.  
  34.     if !Empty( aStack )
  35.  
  36.         uRet = aTail( aStack )
  37.         aSize( aStack, len( aStack ) - 1 )
  38.  
  39.     endif
  40.  
  41. Return uRet
  42.