java - Overriding the public variables in super and sub class -


this question has answer here:

hi create objects child class , try call child class variables called super class variable both super class , sub class have same class variable name .

in output name "child" expecting "o2.name;" output "base".please explain me clearly...

variables not polymorphic in java; not override 1 another. when make variable of same name in subclass, that's called hiding. resulting subclass have both properties. can access 1 superclass super.var or ((superclass)this).var


Comments

Popular posts from this blog

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -