Distinguish between static binding and dynamic binding. Explain the use of virtual func- tions and the vtable in dynamic binding.

What will be an ideal response?


Static binding is performed at compile time when a function is called via a specific object or via a pointer/reference to an object. Dynamic binding is performed at run-time when a virtual function is called via a base-class pointer/reference to a derived-class object (the object can be of any derived class). The virtual functions table (vtable) is used at run-time to enable the proper function to be called for the object to which the base-class pointer/reference “points”. Each class containing virtual functions has its own vtable that specifies where the virtual functions for that class are located. Every object of a class with virtual functions contains a hidden pointer to the class’s vtable. When a virtual function is called via a base-class pointer, the hidden pointer is dereferenced to locate the vtable, then the vtable is searched for the proper function call.

Computer Science & Information Technology

You might also like to view...

The data that is stored in a row of a database is divided into __________.

a. sections b. tables c. bytes d. columns

Computer Science & Information Technology

What is the difference between Navigation and Edit modes? How can you tell you are ineach mode?

What will be an ideal response?

Computer Science & Information Technology

When you make changes to a base style:

A) the base style and any styles based on it will all be updated. B) only the base style will be updated. C) you will be asked to choose whether or not you want styles based on it updated also. D) a new style will be created with the change, but the base style itself will not change.

Computer Science & Information Technology

In SharePoint, the three-state workflow manages document expiration and retention by allowing participants to decide whether to retain or delete expired documents

Indicate whether the statement is true or false

Computer Science & Information Technology