Joined: Wed Mar 28, 2007 1:17 pm Posts: 118 Location: Cairo-Egypt Has thanked: 0 time Have thanks: 5 time
What are Virtual Functions? ---------------------------------------------
Virtual Functions are the basis of Polymorphism ط£آ¢أ¢â€ڑآ¬أ¢â‚¬إ“ they provide the mechanics of late binding. A class, which has at least one function declared as Virtual has a V-Table associated with it. V-Table maintains pointers of all the Virtual functions of that class.
All objects of that class point to the same V-Table. Whenever there is a call made to a function which is virtual, the pointer to that function is obtained during runtime from the V-Table. Hence there is dynamic binding or late binding that leads to the function of the derived class getting called.