Quote:
Yeah, OK, so here is the thing.
The C++ compiler works only on type information. It does not have any meta data information.
It does not know what type the actual object is, only what type you are telling it it is.
That is, the type of the variable is what type the compiler assumes it is.
So if a really is a Shape, then what the line does is "hey compiler, I want this to be a reference to a Square, and I want you to access its member bounce."
The compiler will obey you and try doing it. What actually happens is anyone's guess, because it's undefined territory.
Also, tools are dumb is the same sense, as well. You are telling it to treat the type as a Square when it really isn't, and it's just happy to oblige.
Bloody ashes, that was what I wanted to hear...what took you so long? :O