REFERENCE.md

May 30, 2016 ยท View on GitHub

classes:new()

Creates instance of specified class.

Example

  classes:new ClassName var 12345
  $var::methodFoo

See also

classes:require()

Source file with class declaration.

Class should be declared using following syntax:

   @class ClassName

       @method methodFoo() {
             # here is available two variables
             # $this refers to current instance
             # $identifier string representation of object identifier
             echo "Was created with following identifier: $identifier"
             $this::methodBar arg1
       }

       @method methodBar() {
             echo "There is same identifier: $identifier"
             echo "args: $@"
       }

Example

  classes:require foo.class.sh
  classes:new Foo var
  $var::methodFoo