Online Course Discussion Forum
APCSA question
Does it compile at all? The "food" variable is of "Food" class. Even though the object it references is a "Pizza" type, the compiler would not know that, so it should not know the "s2" field is available. I would expect the compiler to give an error right there. I am surprised that the code could pass compile and start to run.
社交网络