Changes between Version 12 and Version 13 of Classes
- Timestamp:
- 11/22/10 19:34:20 (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Classes
v12 v13 12 12 === Class Grammar === 13 13 {{{ 14 #!cobra 14 15 class <ClassName> 15 16 [is <AccessModifiers>] … … 55 56 === Instance and Class variable definition Grammar === 56 57 {{{ 58 #!cobra 57 59 var <variableName> [as <Type>] [= <initialValue>] [is <AccessModifiers> [has <Attributes>] ] 58 60 [<DocString>] … … 65 67 e.g. 66 68 {{{ 69 #!cobra 67 70 var x as String 68 71 var _y as int … … 89 92 e.g. 90 93 {{{ 94 #!cobra 91 95 var _x = 100 # default protected 92 96 def tryx( opnd as int) as int … … 139 143 140 144 {{{ 145 #!cobra 141 146 get <propName> [ as <Type>] [from {var, <backingVariableName>} [= <initValue>] ] 142 147 [<DocString>] … … 160 165 === Property Example === 161 166 {{{ 167 #!cobra 162 168 var _x = 47 163 169 pro x from var # property x uses backing var _x … … 168 174 Can do all of the above in one line like 169 175 {{{ 176 #!cobra 170 177 pro x = 47 171 178 # or … … 175 182 Above is equivalent to fully specified accessor form 176 183 {{{ 184 #!cobra 177 185 var _x = 47 178 186 pro … … 202 210 === Method Grammar === 203 211 {{{ 212 #!cobra 204 213 def <methodName> [as <returnType>] [is <AccessModifiers>] 205 214 [has <Attributes>] … … 227 236 228 237 {{{ 238 #!cobra 229 239 <paramName> [as [<paramDesc>] <Type>] [, ...] 230 240 }}} … … 245 255 e.g. 246 256 {{{ 257 #!cobra 247 258 def meth( a, b is String, c is out String) 248 259 c = b + "_meth" … … 271 282 272 283 {{{ 284 #!cobra 273 285 class SimplestClass 274 286 pass … … 290 302 291 303 {{{ 304 #!cobra 292 305 #Interfaces 293 306 interface Audible