Does that mean the reference s refers to the anonymous sub class ? a bit confused.
(code tags added) [ May 21, 2004: Message edited by: Barry Gaunt ]
posted 13 years ago
The above code makes a new object from a subclass of class Super. The new subclass has been provided with a new implementation of method method1 which overrides the base class' implementation. Then that new object has been assigned to the variable s which is of type Super, the base class. When s.method1() is executed, the subclass' version of method1 gets called (normal polymorphism behaviour).