Skip to content

Instantly share code, notes, and snippets.

@darrenbkl
Created January 12, 2020 13:00
Show Gist options
  • Save darrenbkl/a9660868b7911c76ae8108d3fddfb8ae to your computer and use it in GitHub Desktop.
Save darrenbkl/a9660868b7911c76ae8108d3fddfb8ae to your computer and use it in GitHub Desktop.
public interface Planet {
void accept(Explorer explorer);
}
public class Mercury implements Planet {
@Override
public void accept(Explorer explorer) {
explorer.visit(this);
}
}
public class Mars implements Planet {
@Override
public void accept(Explorer explorer) {
explorer.visit(this);
}
}
public class Saturn implements Planet {
@Override
public void accept(Explorer explorer) {
explorer.visit(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment