So when you override a method using the
polymorphism of, per your example:
Base b = new Derived();
b.foo();// foo has to be defined in Base!
Here's the confusion (conquer this and you'll have it!):
The reference variable (in this case the Base or Super) provides for what method CAN be called. So you have to have it defined or implemented in the Base or Interface. However, IF IT IS defined in the base/super class, it's the object instance that's being pointed to (in your case the subclass) that will be the method ran. So it's a bit confusing because the reference decides if the method is allowed while the object BEING referenced determines which code will run (after it passes the first condition of being available). And of course this is easier if I try to code it for you:
I did the code off the top of my head so there my be a mistake but the fact is that you have to define a method in the Super/Base/Parent for you to actually be overriding anything in the Sub/Derived/Child. In your example, you actually have a method that is unique to the child class so no overriding is even taking place. Ok, I've described this about as many ways as I can think...let me know if it's making sense now