Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active December 21, 2022 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcsee/3edd25966d27541140a3e4672f5e9b3c to your computer and use it in GitHub Desktop.
Save mcsee/3edd25966d27541140a3e4672f5e9b3c to your computer and use it in GitHub Desktop.
abstract class Collection {
public abstract int size();
}
final class Stack extends Collection {
private contents[] ArrayList;
public Stack() {
contents = new long[maxSize];
}
public void push(Object value) { … }
public Object pop() { … }
public int size() {
return contents.size();
}
}
final class ArrayList extends Collection {
public int size() {
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment