Talk:CSC 216/s08/strive for happiness

From Expertiza_Wiki
Jump to navigation Jump to search

I think this could be a good exercise, but it would take a bit more work. More detailed examples should be given, so that some of the interesting cases of overriding can be illustrated (for example, cases where parameters of methods in super- and subclass are of different types, so that the method is actually overloaded instead of being overridden). In Java, the compiler decides between two methods of the same name but different parameter types, while if the parameter types and method name is the same, then the method is overridden, and the choice of which one to invoke is made at run time, depending on the class of the actual receiver. Many subtle differences are possible, and the game could be used to illustrate these.