compiler-design-eth/javali_tests/HW3_nop90/InheritanceTests/OkAccessField.javali

31 lines
357 B
Text
Raw Permalink Normal View History

2020-01-15 22:32:25 +01:00
// Access inherited and hidden fields (general check)
class Other {
int a;
int b;
Object c;
Other o;
}
class Main extends Other {
int a, b;
void main() {
Other o;
o = (Other) this;
a = 1;
b = 2;
o.a = -1;
o.b = -2;
write(a);
write(b);
write(o.a);
write(o.b);
if (c != null) {
if (o.o != null) {
write(0);
}
}
}
}