Changes between Version 7 and Version 8 of Classes
- Timestamp:
- 02/19/09 00:31:41 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Classes
v7 v8 6 6 === Class Grammar === 7 7 {{{ 8 class < className>8 class <ClassName> 9 9 [is <AccessModifiers>] 10 10 [has <Attributes>] 11 [where <GenericParam> must be <GenericConstraints>] 11 12 [inherits <BaseClassName> ] 12 13 [implements <InterfaceName> [, <InterfaceName>]...] … … 36 37 [is <AccessModifiers>] 37 38 [has <Attributes>] 39 [where <GenericParam> must be <GenericConstraints>] 38 40 [inherits <BaseInterfaceName> [, <BaseInterfaceName>]... ] 39 41 [<DocString>] … … 224 226 return 'Herbivorous Cud Chewing' 225 227 226 def n Hooves as String227 return 'four'228 def numHooves as int 229 return 4 228 230 229 231 … … 264 266 pass 265 267 266 def age( 268 def age(byNYears as int) 267 269 _age += byNYears 268 270 if _age > _lifeSpan 269 271 _isAlive = false 270 272 271 def gainWgt( 273 def gainWgt(wgt as int) 272 274 .liveWeight += wgt 273 275 274 276 def toString as String is new 275 return 'Sheep:age=[_age], w gt=[.liveWeight], living=[_isAlive]'277 return 'Sheep:age=[_age], weight=[.liveWeight], living=[_isAlive]' 276 278 277 279 def main is shared 278 280 s = Sheep() 279 print 's=[s .toString]'281 print 's=[s]' 280 282 s.age(1) 281 283