File: classsuper2.bsh

package info (click to toggle)
bsh 2.0b4-15
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 4,212 kB
  • sloc: java: 23,430; xml: 4,500; sh: 139; makefile: 30
file content (33 lines) | stat: -rw-r--r-- 662 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
source("TestHarness.bsh");
/*
	Make sure we can call super.method() whether or not we have overridden the
	method.
*/

class Super2 extends Base 
{
	public void go() {
		assert( baseMethod().equals("baseMethod") );
		assert( super.baseMethod().equals("baseMethod") );
	}

	public String baseMethod2( int i ) {
		assert( super.baseMethod2().equals("baseMethod2") );
		try {
			assert( super.baseMethod2().equals("baseMethod2") );
		} catch ( Exception e ) { }
		return "child2";
	}

	// non public extending public
	String baseMethod3() {
		return "child3";
	}
}

s=new Super2();
s.go();
s.baseMethod2(4);
assert( s.baseMethod3().equals("child3") );

complete();