Function Binding

Question:
Is there a compiler or run-time option to specify whether to use static binding or dynamic binding for function calls? This option, if it exists, may actually override the virtual mechanism.

Answer:
No, such compiler option doesn’t (and shouldn’t) exist. The dynamic binding mechanism may be overriden explicitly when you use a fully qulaified name of a member function:

Date date;date.Date::Display(); //static binding

Even if Display() happens to be virtual, the fully qualified call above will resolve statically.

I see no reason why compilers would need this feature. The choice between static and dynamic binding is solely a programmer’s choice, and the binding is dynamic under very strict conditions:
1) the function is virtual.
2) the function is called through a pointer or a reference to an object.

Otherwise, the call is resolved statically.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS