home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 6.1 Scope of PRIVATE variables
- Author: Greg Lief
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063-4728
- (415) 366-3600
- */
-
- //───── NOTE: must compile with the /N option!
-
- // using inherited variables
- function main
- myfunc1()
- ? mvar // crash -- not visible here
- return nil
-
-
- function myfunc1
- private mvar := 200 // note in-line initialization
- myfunc2()
- ? mvar // 416
- return nil
-
-
- function myfunc2
- mvar *= 2
- myfunc3()
- return nil
-
-
- function myfunc3
- mvar += 16
- return nil
-
- // end of file CHP0601.PRG
-