SHARE
TWEET

Untitled

a guest Aug 12th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  #this is a comment
  2.  
  3.  value; # create a new variable, initializing it to 0
  4.  
  5.  value = 14; # assign it a new value
  6.  
  7.  function f(x) {
  8.     return x;
  9.  }
  10.  
  11.  class Foo { #implicit derives from object
  12.  
  13.     value; # private by default
  14.  
  15.  public: # here everything is public
  16.  
  17.     Foo() {  # hail the costructor ( implicitly calls base() to construct object too )
  18.         value = "Hello world";
  19.     }
  20.  
  21.     Foo():base(Serialize.true) { # passes an argument to object constructor
  22.         value = "Hello world";
  23.     }
  24.  
  25.     # ~Foo(); #destructor
  26.  
  27.     property Value { # C# style property
  28.         get {
  29.             return value;
  30.         } set {
  31.             this.value = value;
  32.         }
  33.     }
  34.  
  35.  protected: # protected now
  36.  
  37.     public function x(); # only this method is public
  38.  
  39.     function z(); # but this is protected
  40.  
  41.  }
  42.  
  43.  enum Serialize {
  44.  
  45.     byVal, # = 0
  46.     byRef,  # = previous + 1 = 1
  47.     byPtr = 100 # = 100
  48.     None # = previous + 1 = 101
  49.  
  50.  }
  51.  
  52.  enumerized = Serialize.byVal;
RAW Paste Data
Top