Created
May 22, 2013 10:24
-
-
Save sakamotodesu/5626614 to your computer and use it in GitHub Desktop.
酒と泪と男と女をオブジェクト指向で表現してみた
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Man extends Human { | |
@Override | |
void ProtectMyself() { | |
drink(new Happoushu()); | |
} | |
private void drink(Alcohol alcohol) { | |
if (alcohol != null) { | |
memory = null; | |
sleep = true; | |
} | |
} | |
} | |
public class Woman extends Human { | |
@Override | |
void ProtectMyself() { | |
cry(); | |
} | |
private Tears cry() { | |
new Tears(); | |
new Tears(); | |
new Tears(); | |
memory = null; | |
return new Tears(); | |
} | |
} | |
public abstract class Human { | |
protected Object memory; | |
protected boolean sleep; | |
public void sadEvent() { | |
ProtectMyself(); | |
} | |
abstract void ProtectMyself(); | |
} | |
public class Happoushu implements Alcohol { | |
} | |
interface Alcohol extends Water { | |
} | |
public class Tears implements Water { | |
} | |
public interface Water { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment