This page was last modified 13:40, 8 December 2007.
Virtual functions
From Forum Nokia Wiki
Virtual functions are implemented using a table of function pointers, called the vtable. There is one entry in the table per virtual function in the class. This table is created by the constructor of the class. When a derived class is constructed, its base class is constructed first which creates the vtable. If the derived class overrides any of the base classes virtual functions, those entries in the vtable are overwritten by the derived class constructor. This is why you should never call virtual functions from a constructor: because the vtable entries for the object may not have been set up by the derived class constructor yet, so you might end up calling base class implementations of those virtual functions.
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Do libc functions leave? | raicuandi | Open C | 1 | 2008-01-27 09:25 |
| how to connect a pc and mobile | sulabh120881 | PC Suite API and PC Connectivity SDK | 18 | 2007-01-05 08:52 |
| Adding a certificate to certificate store programmatically | manishraj | General Symbian C++ | 44 | 2008-05-06 13:24 |
| how to make synchronous methods asynchronous? | rtrnokia | General Symbian C++ | 3 | 2007-11-15 05:58 |
| retrieve & store data in Nokia 3100 | business2share | Mobile Java General | 0 | 2004-09-29 16:04 |
