Last active
December 27, 2015 03:48
-
-
Save nemecec/7261805 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 enum AnimalType { | |
DOG { | |
public Animal createAnimal() { | |
return new Dog(); | |
} | |
}, | |
CAT { | |
public Animal createAnimal() { | |
return new Cat(); | |
} | |
}, | |
COW { | |
public Animal createAnimal() { | |
return new Cow(); | |
} | |
}, | |
ANY { | |
public Animal createAnimal() { | |
return new Cat(); | |
} | |
}; | |
public abstract Animal createAnimal(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment