Example from Waldemar's spec.

git-svn-id: svn://10.0.0.236/trunk@82710 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rogerl%netscape.com
2000-11-16 23:50:37 +00:00
parent 3ea393cc5b
commit 94fd6cbddb
2 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
load("verify.js");
class C {
var x:Integer = 3;
function m() {return x}
function n(x) {return x+4}
}
var c:C = new C;
verify( c.m(), 3 ); // returns 3
verify( c.n(7), 11 ); // returns 11
var f:Function = c.m; // f is a zero-argument function with this bound to c
verify( f(), 3 ); // returns 3
c.x = 8;
verify( f(), 8 ); // returns 8

View File

@@ -0,0 +1,16 @@
load("verify.js");
class C {
var x:Integer = 3;
function m() {return x}
function n(x) {return x+4}
}
var c:C = new C;
verify( c.m(), 3 ); // returns 3
verify( c.n(7), 11 ); // returns 11
var f:Function = c.m; // f is a zero-argument function with this bound to c
verify( f(), 3 ); // returns 3
c.x = 8;
verify( f(), 8 ); // returns 8