Wiki

Changes between Version 1 and Version 2 of Variables

Show
Ignore:
Timestamp:
01/16/13 00:13:48 (11 years ago)
Author:
hopscc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Variables

    v1 v2  
    2424lowercase letter (no leading underscores or punctuation). 
    2525 
    26 They come into existance on first assignment unless explicitly declared 
     26They come into existence on first assignment unless explicitly declared 
    2727but are created local to the '''method''' they appear in (not just the block they 
    2828might have been first used in). [[BR]] 
     
    3131 
    3232Local variables can be explicitly typed if desired otherwise they infer their type from the 
    33 type of what they are assigned from. 
     33type of what they are assigned from.[[BR]] 
     34If explicitly declared (or typed) they can also have the usual AccessModifiers for variables imposed on them. 
    3435 
    3536{{{ 
     
    8485== Instance Variables == 
    8586 
    86 Instance variables are variables associated with a class instance. [[BR]] 
     87Instance variables are variables associated with a Type (commonly class) instance. [[BR]] 
    8788They encapsulate the state of the instance object [[BR]]  
    88 They must be declared (using the '''var''' keyword in a class/structure/interface definition) 
     89They must be declared (using the '''var''' keyword in a Type (class/structure/interface) definition) 
    8990but they too can be explicitly typed or have their type inferred from being initialised in  
    9091the declaration. [[BR]] 
    91 Like method parameter variables, if untyped and uninitialised, their type defaults to type '''dynamic'''. 
     92Like method parameter variables, if untyped and uninitialised, their type defaults to type '''dynamic'''.[[BR]] 
    9293 
    9394Instance variables default to public access. [[BR]]  
    9495If named with a leading '_' they default to protected access, with double leading '_' to private access. [[BR]] 
    9596Accessibility may be explicitly specified otherwise or overridden with an 'is clause' specifying one  
    96 of 'public', 'protected', 'private'.  
     97of 'public', 'protected', 'private' as per the usual variable AccessModifiers. 
    9798 
    9899{{{ 
     
    165166Method parameter variables are named the same way as local variables ( leading lowercase letter) 
    166167and are also local only to the method they are on. [[BR]] 
    167 Calls to the methods convey the args given in the call to the (formal) parameter names in the order  
     168Calls to the methods convey the arguments given in the call to the (formal) parameter names in the order  
    168169declared on the method for use in the called method. 
    169170 
     
    224225}}} 
    225226 
     227These variables can also be created subject to the usual AccessModifiers for variables. 
    226228 
    227229 
     
    230232== See Also == 
    231233 
     234[wiki:AccessModifiers Access Modifiers] 
     235 
    232236 
    233237[wiki:LanguageTopics Back to LanguageTopics]