+ 2

Runtime polymorphysm mechanism

Hi I am aware about vptr and vtable. I am curious to know what all happens at run time and compile time. ? Does vptr and vtable are build at compile time only ?

19th Jan 2020, 6:05 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Answer
+ 2
TheĀ compilerĀ atĀ compile timeĀ sets up oneĀ VTABLEĀ each for a class having virtual functions as well as the classes that are derived from classes having virtual functions. AĀ VTABLEĀ contains entries that are function pointers to the virtual functions that can be called by the objects of the class. Answer from: https://www.google.com/url?sa=t&source=web&rct=j&url=https://www.softwaretestinghelp.com/runtime-polymorphism-in-cpp/amp/&ved=2ahUKEwjs0YKC94_nAhWNB50JHXANADMQFjABegQIDRAK&usg=AOvVaw2uAw7OAt6IRtbZKh0201TA&ampcf=1
19th Jan 2020, 3:01 PM
George Ryan
George Ryan - avatar