File: class5.bsh

package info (click to toggle)
bsh 2.0b4-20
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 4,224 kB
  • sloc: java: 23,431; xml: 4,500; sh: 139; makefile: 24
file content (42 lines) | stat: -rw-r--r-- 571 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
source("TestHarness.bsh");

assert(true);
class Foo55 
{ 
	int x;

	Foo55() { 
		this(0);
		assert( x == 42 );
		assert( this.x == 42 );
		this.x = 43;
		assert( x == 43 );
		assert( this.x == 43 );
	}

	Foo55( int a ) 
	{
		assert( x == 0 );
		assert( this.x == 0 );
		this.x = 42;
		assert( this instanceof Foo55 );
	}

	void go1() {
		this.x = 5;
		assert( this instanceof Foo55 );
		assert( this.x == 5 );
		go2();
	}
	void go2() {
		this.x = 6;
		assert( this instanceof Foo55 );
		assert( this.x == 6 );
	}
}

f=new Foo55();
f.go1();
assert( f.x==6 );

complete();