I understand the advantages and the uses of dynamic binding. I also understand how it works and what I need to do to make it work. In short, only member functions can be dynamically bound and the call has to be made through a reference or pointer to a base class.
I coded some toy classes to test this and understand the concept. All is well...
However, being this the cornerstone of polymorphism, and such a fundamental concept, I would like to understand it better.
The problem I have is that I cannot abstract myself enough to understand the following statement:
I cannot understand why is that the compiler cannot know the pointer or reference to a base class type is actually pointing or referencing a derived type. Why is this information only obtainable at run-time?Quote:
Originally Posted by C++ Primer