compiler-design-eth/javali_tests/HW3_nop90/InheritanceTests/OkAccessField.javali
Carlos Galindo 0afc86ceeb
Homework 3
2020-01-15 22:32:25 +01:00

30 lines
357 B
Text

// 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);
}
}
}
}