Downcasting using the Static_cast in C++
<pre><code>class base
{
 base();
 virtual void func();
}

class derived : public base
{
 derived();
 void func();
 void func_d();
 int a;
}


main
{
 base *b  = new base();
 sizeof(*b); //  gives 4.
 derived * d = static_cast&lt;derived*&gt;(b);
 sizeof(*d); // gives 8- means whole derived obj size..why?   
 d-&gt;func_d();
}
</code></pre>

<p>In the above code i did downcasting of a base pointer which points to base object to derived class pointer. i am wondering how derived pointer has the whole derived class object. i can call the derived class function (declared in derived class only). i did not get the concept here.</p>
