Addresses of virtual functions in vtable
<p>Lets say there is a class named Person which contains a virtual function named age(). As per language semantics, vtable is per class and not per object. It is VPTR which is per object and points to vtable.</p>

<p>Questions:</p>

<p>If I build this program (lets say main() exist):</p>

<ol>
<li><p>Will the vtable be created i.e can vtable comes in existence w/o even creating a single object?</p></li>
<li><p>The address which is put by compiler in vtable for age() is a kind of some static address in memory?</p></li>
<li><p>Or is it that compiler internally creates some object for obtaining the address to age() (since age() will be working on some data members which can come in existence only when an object is constructed) or there is some other magic behind this?</p></li>
</ol>

<p>As per my understanding, the answers are as follows:</p>

<ol>
<li>Yes</li>
<li>Yes</li>
<li>Not sure</li>
</ol>

<p>I tried running "nm" on above program just to see if I can figure out the vtable, but no luck. Is there a way to do so?</p>

<p>Please suggest.</p>
