Child Function Calls Parent Function Instead
<p>I'm having difficulties trying to get a child function to work:</p>

<h3>.h file</h3>

<pre><code>class Parent {
    int id;
    public:
        virtual int getid();
} 

class Child : public Parent {
    int id;
    public:
        int getid();
}
</code></pre>

<h3>.cc file</h3>

<pre><code>Parent::Parent( int num ) {
    id = num;
}

int Parent::getid() {
    cout &lt;&lt; "Parent!"; 
    return id;
}

Child::Child( int num ) : Parent(num) {
    id = num;
}

int Child::getid() {
    cout &lt;&lt; "Child!";
    return id;
}
</code></pre>

<p>When I make <code>Child kid = Child(0);</code> and call <code>kid.getid();</code>, I would get <code>Parent!</code> instead of <code>Child!</code>.</p>

<p>What is wrong with my implementation? </p>
