An Example of Dynamic Dispatching in Object-Oriented Systems

Say we have a class called InstrumentedHashSet that extends the HashSet class from Java’s Collection library.

import java.util.Collection;
import java.util.HashSet;
public class InstrumentedHashSet<E> extends HashSet<E> {

Now, let’s add a private instance variable called addCount along with an empty…