package oop.Abstraction.Zoo;


public abstract class Animal {
	private String name;
	private int birthyear;
	private String species;

	public Animal(String name, int birthyear) {
		this.name = name;
		this.birthyear = birthyear;
		
		species = this.getClass().getName();
		species = species.substring(species.lastIndexOf(".")+1);
	}

	public abstract void speak();
	
	public String getSpecies() {
		return species;
	}
	
	public static Animal tiereErzeugen(String nameTier) {
		
		switch(nameTier) {
			case "Katze":
				return new Cat(nameTier,12);
			
			case "Hund":
				return new Dog(nameTier,12);
						
			default:
				return null;
				
		}
	}

}
