Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; main.au3 ; let obj;
- #include "Doubler.au3"
- local $obj[]
- $obj["constructor"] = Doubler ;
- $obj["constructor"]($obj, 128) ; obj = new Doubler(128);
- MsgBox(0, "", $obj["Double"]($obj, 32)) ; alert(obj.Double(32));
- ;
- $obj["DoubleMe"]($obj) ; obj.DoubleMe();
- MsgBox(0, "", $obj["n"]) ; alert(obj.n);
- ; Doubler.au3
- #include-once
- ; class Doubler {
- func Doubler(byref $this, $n) ; constructor(n) {
- ; properties
- $this["n"] = $n ; this.n = n;
- ; methods
- $this["Double"] = DoublerDouble ; this.Double = DoublerDouble;
- $this["DoubleMe"] = DoublerDoubleMe ; this.DoubleMe = DoublerDoubleMe;
- endfunc ;
- func DoublerDouble(byref $this, $x) ; Double(x) {
- return $x*2 ; return x*2;
- endfunc ; }
- func DoublerDoubleMe(byref $this) ; DoubleMe() {
- $this["n"] = $this["Double"]($this, $this["n"]) ; this.n = this.double(this.n);
- endfunc ; }
- ; }
Advertisement
Add Comment
Please, Sign In to add comment