I couldn't understand that either, until I tried to compile the code (both ways) and found that it compiled perfectly well (both ways).
However when I tried to run the code, it runs perfectly well because the compile was successful. In the one case the runtime (not the compiler) outputs that error message you posted, and in the other case it didn't output anything.
So you're confusing compiling code with running code. Hope that clears up the confusion.
Yes, that's right. And remember that the compiler doesn't make any attempt to analyze the code (as you did there). All it officially knows about the variable "a" is that it was declared as type "A". It doesn't look at anything other than that.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop