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

16 lines
240 B
Text
Raw Permalink Normal View History

2020-01-15 22:32:25 +01:00
// Hide a field from a superclass (type doesn't need to match)
class Parent {
int a;
}
class Main extends Parent {
Object a;
Main b;
void main() {
Parent c;
b = new Main();
b.a = new Object();
c = new Parent();
c.a = 10;
}
}