- This wiki is out of date, use the continuation of this wiki instead
Public variable
From FenixWiki
(Difference between revisions)
Revision as of 01:14, 18 June 2007 (edit) Sandman (Talk | contribs) ← Previous diff |
Revision as of 01:20, 18 June 2007 (edit) (undo) Sandman (Talk | contribs) m Next diff → |
||
Line 2: | Line 2: | ||
== Definition == | == Definition == | ||
- | A public variable is a [[variable]] that is specific to a [[process]] or [[function]] in the same way as a [[private variable]]. | + | A public variable is a [[variable]] that is specific to a [[process]] or [[function]] in the same way as a [[private variable]]. Unlike a private variable, however, a public variable can be accessed from the rest of the program, by use of the [[ProcessID]] of that process. |
Because of the way the compiler works, public variables are only accessible for processes and functions below the declaration (which in fact is pretty normal). To assist in this matter, the statement [[Declare]] was created. | Because of the way the compiler works, public variables are only accessible for processes and functions below the declaration (which in fact is pretty normal). To assist in this matter, the statement [[Declare]] was created. |
Revision as of 01:20, 18 June 2007
Definition
A public variable is a variable that is specific to a process or function in the same way as a private variable. Unlike a private variable, however, a public variable can be accessed from the rest of the program, by use of the ProcessID of that process.
Because of the way the compiler works, public variables are only accessible for processes and functions below the declaration (which in fact is pretty normal). To assist in this matter, the statement Declare was created.
Example
Process SpaceShip Public int speed; String name; Begin Loop frame; End End
This is for example when a ship is needed, of which the speed and name want to be accessible from the rest of the program. This way, one can easily have multiple instances of the same ProcessType, but still have the appropriate variables easily accessible.