home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP06.EXE / CHP0601.PRG < prev    next >
Encoding:
Text File  |  1991-04-30  |  711 b   |  38 lines

  1. /*
  2.    Listing 6.1 Scope of PRIVATE variables
  3.    Author: Greg Lief
  4.    Excerpted from "Clipper 5: A Developer's Guide"
  5.    Copyright (c) 1991 M&T Books
  6.                       501 Galveston Drive
  7.                       Redwood City, CA 94063-4728
  8.                       (415) 366-3600
  9. */
  10.  
  11. //───── NOTE: must compile with the /N option!
  12.  
  13. // using inherited variables
  14. function main 
  15. myfunc1() 
  16. ? mvar    // crash -- not visible here 
  17. return nil
  18.  
  19.  
  20. function myfunc1 
  21. private mvar := 200 // note in-line initialization 
  22. myfunc2() 
  23. ? mvar    // 416 
  24. return nil 
  25.  
  26.  
  27. function myfunc2 
  28. mvar *= 2 
  29. myfunc3() 
  30. return nil 
  31.  
  32.  
  33. function myfunc3 
  34. mvar += 16 
  35. return nil
  36.  
  37. // end of file CHP0601.PRG
  38.