sizeof *this object
<p>Code:</p>

<pre><code>#include &lt;cstdio&gt;

class myc {
    int dummy;
public:
    int si(){return sizeof(*this);}
};

class d_myc : public myc {
    int d_dummy;
};

int main() {
    myc a;
    d_myc b;
    printf("%d %d\n%d %d", a.si(), b.si(), sizeof(a), sizeof(b));
    return 0;
}
</code></pre>

<p>output :</p>

<pre><code>4 4
4 8
</code></pre>

<p>I expected :</p>

<pre><code>4 8
4 8
</code></pre>

<p>Why were my expectations wrong?</p>
