Next Scripting Framework

Next Scripting Framework

 # How to invoke current class method:

 

package require nx

nx::Class create Greeter {
    :property name:required
    :public method "hello" {} {
        puts "Welcome ${:name}!"
        :bye
    }
    :public method "bye" {} {
        puts "Goodbye ${:name}!"
    }
}

Greeter create g -name Anna
g hello

 

# Inheritance Example:

 

# Inheritance Example

package require nx

nx::Class create Animal {
:property name:required
:public method "hello" {} {
puts "Hello cute animal with the name ${:name}!"
}
}

nx::Class create Dog -superclass Animal {
:public method "bark" {} {
puts "${:name} bark! bark! bark!"
}
}

Dog create d -name Snoopy
d bark

Dog create d1 -name "Bobby"
d1 bark
d1 hello 

Comments

Popular posts from this blog

Mapserver install on Ubuntu 18.04 with Naviserver:

Certbot