I got you, first of all, in JAVA. However, what you do is not an override of methods, if you do this, it will work the way you want:
public class Foo{ int a = 3; public void addFive() { a+=5; System.out.println("f");} public int getA() {return a;} } class Bar extends Foo{ int a = 8; public void addFive() { this.a+=5; System.out.println("b");} public int getA() {return a;} }
I hope you have a problem.
source share