Skip to content

Instantly share code, notes, and snippets.

@aioobe
Created March 29, 2016 14:19
Show Gist options
  • Save aioobe/0a7feacfd467e5b9ef41 to your computer and use it in GitHub Desktop.
Save aioobe/0a7feacfd467e5b9ef41 to your computer and use it in GitHub Desktop.
public class Main {
public static void main(String[] args) {
Person andreas = new Person("Andreas");
Werewolf w = new Werewolf(andreas);
w.brain.think();
}
}
class Person {
String name;
public Person(String name) {
this.name = name;
}
public class Brain {
public void think() {
System.out.println(name + " is thinking");
}
}
}
class Werewolf {
WerewolfBrain brain;
public Werewolf(Person p) {
brain = new WerewolfBrain();
}
class WerewolfBrain extends Person.Brain {
WerewolfBrain() {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment