Free for PREMIUM members
[Last Call] Learn how to a build a cloud-first strategyRegister Now
An object's dispatch table will contain the addresses of the object's dynamically bound methods. Method calls are performed by fetching the method's address from the object's dispatch table. The dispatch table is the same for all objects belonging to the same class, and is therefore typically shared between them. Objects belonging to type-compatible classes (for example siblings in an inheritance hierarchy) will have dispatch tables with the same layout: the address of a given method will appear at the same offset for all type-compatible classes. Thus, fetching the method's address from a given dispatch table offset will get the method corresponding to the object's actual class
b is a pointer to 'vehicle' class. Then, how can b point to 'FourWheeler' class?
[[data members of Vehicle][additional data members of FourWheeler]]
Open in new window
New feature! Upgrade and increase expert visibility of your issues with Priority Questions.