I am having trouble understanding why does the output change after removing a variable from a subclass
<p>Hello in the code below the output is "A", I don't understand why the output (the 'value' variable) changes to "B" after removing the value variable from the subclass B</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;

using namespace std;

class A {
public:

    string value;
    A(){
        value = "A";
    }

    void display(){
        cout&lt;&lt;value&lt;&lt;endl;
    }

};

class B : public A{
public:

    string value;
    B(){
        value = "B";
    }


};

int main(){
    A *c = new B();
    c-&gt;display();

}
</code></pre>