1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/DispatchTest.java Thu Nov 11 15:24:21 2004 +0100
1.3 @@ -0,0 +1,32 @@
1.4 +public class DispatchTest {
1.5 + public int a;
1.6 + public float b;
1.7 +
1.8 + public DispatchTest() {
1.9 + this.a = 1;
1.10 + this.b = 2;
1.11 + }
1.12 +
1.13 + public DispatchTest(int a) {
1.14 + this.a = a;
1.15 + this.b = 2;
1.16 + }
1.17 +
1.18 + public DispatchTest(float b) {
1.19 + this.a = 1;
1.20 + this.b = b;
1.21 + }
1.22 +
1.23 + public DispatchTest(int a, float b) {
1.24 + this.a = a;
1.25 + this.b = b;
1.26 + }
1.27 +
1.28 + public void set(int a) {
1.29 + this.a = a;
1.30 + }
1.31 +
1.32 + public void set(float b) {
1.33 + this.b = b;
1.34 + }
1.35 +}
2.1 --- a/tests/Value.java Wed Nov 10 17:47:04 2004 +0100
2.2 +++ b/tests/Value.java Thu Nov 11 15:24:21 2004 +0100
2.3 @@ -1,5 +1,5 @@
2.4 public class Value {
2.5 - private int value;
2.6 + protected int value;
2.7
2.8 public Value(int value) {
2.9 this.value = value;
3.1 --- a/tests/ValueSubclass.java Wed Nov 10 17:47:04 2004 +0100
3.2 +++ b/tests/ValueSubclass.java Thu Nov 11 15:24:21 2004 +0100
3.3 @@ -1,6 +1,31 @@
3.4 public class ValueSubclass extends Value {
3.5
3.6 + /**
3.7 + * Test of subclass initialisation with super usage and foreign object initialisation.
3.8 + */
3.9 public ValueSubclass(int x) {
3.10 super(x);
3.11 + Value tmp = new Value(42);
3.12 + }
3.13 +
3.14 + /**
3.15 + * Test of overriding.
3.16 + */
3.17 + public void setValue(int x) {
3.18 + this.value = -x;
3.19 + }
3.20 +
3.21 + /**
3.22 + * Test of overriding and super methods.
3.23 + */
3.24 + public int add(int x) {
3.25 + return super.add(-x);
3.26 + }
3.27 +
3.28 + /**
3.29 + * Test of objects as arguments.
3.30 + */
3.31 + public void setValueObject(Value v) {
3.32 + this.value = v.getValue();
3.33 }
3.34 }