Hendra Kurniawan wrote:yes, you're referring to hashset's add function.
Actually, he's referring to the "deepest" implementation of add() in the hierarchy. That's how runtime
polymorphism works in
Java.
What confuses me here is that myset's add is also invoked, not just hashset's function.
Your addAll() invokes super.addAll(), which invokes add(). Since add() is overridden, any call to add() that's not qualified with a preceding "
super." will invoke your class's implementation. That's what overriding is all about.