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.
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.