Wiki

Changes between Version 4 and Version 5 of Methods

Show
Ignore:
Timestamp:
11/07/12 13:39:56 (12 years ago)
Author:
hopscc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Methods

    v4 v5  
    11= Methods = 
     2 
     3Methods are blocks of code specific to a class.  
     4They can be thought of as providing the actions that a class instance can be told to do. 
     5 
     6Methods can take zero or a number of parameters passed to them and may return a value. 
    27 
    38Methods within a class are defined using the keyword '''def'''. 
    49 
    5 If not specified the returnType is void (i.e nothing returned)  and the [wiki:AccessModifiers access modifiers]  are '''public, virtual'''[[BR]] 
     10If not specified the returnType of a method is void (i.e nothing returned)  and the [wiki:AccessModifiers access modifiers]  are '''public, virtual'''. 
    611 
    712Like variables, if the name is prefixed with an '''_''' its access modifier defaults to ''protected'' and it is directly accessable from within the class method code.[[BR]] 
     
    914 
    1015Without that prefix on the name of the method  the accessType is ''public, virtual'' and  
    11 it must be accessed from within method code by prefixing the name with either '''this.''' or just '''.''' .[[BR]] 
     16it must be accessed from within method code by prefixing the name with either '''this.''' or just '''.''' (dot) .[[BR]] 
    1217 
    1318== Method Grammar == 
     
    2227 
    2328 
    24 === Method ParamList === 
     29=== Method !ParamList === 
    2530 
    2631A parameter list is a comma separated list of name (and optionally type and parameter description modifier) specifications 
     
    4045 
    4146 
    42 If <Type> is unspecified it is treated as dynamic?[[BR]] 
     47If <Type> is unspecified it is defaulted to and treated as dynamic.[[BR]] 
    4348 
    4449 
     
    7479a baseclass constructor). 
    7580 
    76 If an init method is not specified the compiler runtime generates a noArg constructor that does nothing. 
     81If an init method is not specified the compiler runtime generates a noArg constructor that does nothing (changed - this was original behaviour, now an init method must be explicitly provided). 
    7782 
    7883Constructor chaining can be done to another constructor in the same class (usually with a different number or Type of args)