public class Main { public static void main(String[] args) { Parent p=new Child(); System.out.println(p.num); p.foo(); } } class Parent { public int num = 10; void foo() { System.out.println("Foo in parent"); } } class Child extends Parent { public int num = 100; @Override void foo() { System.out.println("Foo in Child"); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)