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…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store