Method

メソッドです。

method(){}式により生成されます。

主にclass(){}式中で使われ、呼び出し時のthisは呼び出し元のthisが継承されます。また、クラスの中で定義する際にはmethodの表記を省略することができます。

Example

// 別にクラスの外でも定義できる
method outer_method(x){
    x.p;
    this.p;
    this.class.p;
}
 
class Foo{
    _x : 0;
 
    set_x(x){
        _x = x;
    }
    method call_wrap1(m, x){
        m(x);
    }
}
 
foo : Foo();
foo.set_x(10);
 
outer_method("nanchara");
foo.call_wrap1(outer_method, 20);
reference/method.txt · 最終更新: 2011/02/05 06:01 by sukai
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0