Wiki

Changes between Version 12 and Version 13 of Classes

Show
Ignore:
Timestamp:
11/22/10 19:34:20 (13 years ago)
Author:
todd.a
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Classes

    v12 v13  
    1212=== Class Grammar === 
    1313{{{ 
     14#!cobra 
    1415class <ClassName>   
    1516    [is <AccessModifiers>] 
     
    5556=== Instance and Class variable definition Grammar ===  
    5657{{{ 
     58#!cobra 
    5759    var <variableName> [as <Type>] [= <initialValue>] [is <AccessModifiers> [has <Attributes>] ] 
    5860        [<DocString>] 
     
    6567e.g. 
    6668{{{ 
     69#!cobra 
    6770    var x as String 
    6871    var _y as int 
     
    8992e.g. 
    9093{{{ 
     94#!cobra 
    9195    var _x = 100  # default protected 
    9296    def tryx( opnd as int) as int 
     
    139143 
    140144{{{ 
     145#!cobra 
    141146get <propName> [ as <Type>] [from {var, <backingVariableName>} [= <initValue>] ] 
    142147    [<DocString>] 
     
    160165=== Property Example === 
    161166{{{ 
     167#!cobra 
    162168var _x  = 47 
    163169pro x from var     # property x uses backing var _x 
     
    168174Can do all of the above in one line like 
    169175{{{ 
     176#!cobra 
    170177pro x = 47 
    171178# or 
     
    175182Above is equivalent to fully specified accessor form 
    176183{{{ 
     184#!cobra 
    177185var _x = 47 
    178186pro 
     
    202210=== Method Grammar === 
    203211{{{ 
     212#!cobra 
    204213    def <methodName> [as <returnType>]  [is <AccessModifiers>] 
    205214        [has <Attributes>] 
     
    227236 
    228237{{{ 
     238#!cobra 
    229239<paramName> [as [<paramDesc>] <Type>]  [, ...] 
    230240}}} 
     
    245255e.g. 
    246256{{{ 
     257#!cobra 
    247258    def meth( a, b is String, c is out String) 
    248259        c = b + "_meth" 
     
    271282 
    272283{{{ 
     284#!cobra 
    273285class SimplestClass 
    274286    pass 
     
    290302 
    291303{{{ 
     304#!cobra 
    292305#Interfaces  
    293306interface Audible