When will the virtual table be generated? Where is it stored?

We all know that polymorphisms in CPP depend on virtual tables and virtual pointers, so when are virtual tables generated? Is it before or after the constructor is executed? And where are the virtual watches stored?


VMT is implementation dependent, so topics should be limited to compilers implementations rather than cPP itself.

so when is the virtual table generated? Is it before or after the constructor is executed?

For Most compilers, virtual table pointer initializes _ _ vptr at constructor's initializer list.

< hr >
and where are the virtual tables stored?

What confuses you is where _ _ vptr is (not VMT , because VMT just consists of the addresses of trivial non-virtual functions which can be invoked by _ vptr ), then:

Compilers have multiple choices (all as a hidden member), you can refer to here

Summary: Where is the _ _ vptr stored in an object (first or last are the usual answers).

Of course, you can implement VMT with c, then you will not ask such questions.

BTW, this is not good (even is a bad) question, because you even haven't searched it on google before asking, so-1.

< H2 > Update: < / H2 >

Wikipedia is also your friend.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eada0d-216d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eada0d-216d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?