Skip to content

Instantly share code, notes, and snippets.

@ZachOrr
Created November 1, 2012 19:48
Show Gist options
  • Save ZachOrr/3995994 to your computer and use it in GitHub Desktop.
Save ZachOrr/3995994 to your computer and use it in GitHub Desktop.
Emily Lockable
public abstract class Lockable {
int key = 0;
boolean locked = false;
void setKey(int key) {
this.key = key;
}
void lock(int key) {
if(key == this.key) locked = true;
}
void unlock(int key) {
if(key == this.key) locked = false;
}
boolean locked() {
return this.locked;
}
}
@johnmaguire
Copy link

Bizarre, what is this for? Seems like a weird class. Why not just initiate it with a key, and then define lock() and unlock() without any arguments?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment