P
puzzlecracker
At what point does an object (an instance of the class that has virtual
functions) put proper function in the vtable. I dont see it how it is
run-time binding.
Base *d=new Derived (...); // let's say the both have function
// getName() declared as virtual and
//defined in the both class.
Obviously 'd' is a pointer to a an object of class D, but d considers
it as a base class and when virtual function is invoked it consults
vtable. But placing the address of the function to vtable is done at
compile time
Thanks
functions) put proper function in the vtable. I dont see it how it is
run-time binding.
Base *d=new Derived (...); // let's say the both have function
// getName() declared as virtual and
//defined in the both class.
Obviously 'd' is a pointer to a an object of class D, but d considers
it as a base class and when virtual function is invoked it consults
vtable. But placing the address of the function to vtable is done at
compile time
Thanks