Parent member function hiding child's data member
<p>I've a code:</p>

<pre><code>class Parent{
    int x=10;
    void show(){
        System.out.println(x);
    }
}

class Child extends Parent{
    int x=20;
    public static void main(String[] args){
        Child c=new Child();
        c.show();
    }
}
</code></pre>

<p>Here when I run this program the output comes is 10. Which means at runtime Parent member-function not using the Child data-member with same name(data hiding). The thing I know is that whenever we are extending a class its parent class member-function and data-members are available to Child class, then when I say <code>c.show()</code> why it takes the data-member of Parent class not Child class. Also, I want to know that when we create an object of Child class its Parent class data-members are put in the Parent section of Child class object in Heap, but what happens to member-functions?</p>
