Classes can be defined in Bobbee:
class XmlCommentItem : XmlInstanceItem { val data : String; def this (this.data); def toString () : String :> "<!--%s-->" (data); }
XmlCommentItem inherits from XmlInstanceItem.
‶data″ is invariant (a value) once a class instance is created.
def this creates an instance, assigning the value passed to it to the ‶data″ field.
‶toString″ wraps ‶data″ in comment start and end marks.
Beyond OmniMark | Sam Wilmott |
Slide 24 of 37 | www.wilmott.ca |