var Animal = function(name) {
this.name = name;
};
Animal.prototype.talk = function talk(){
console.log("Hi! I'm " + this.name + "");
};
Animal.prototype.walk = function walk(){
console.log("Excuse me " + this.name + " is walking here!");
};
Animal.prototype.munch = function munch(){
console.log("time for " + this.name + " to munch on some grub!");
};
Animal.prototype.evacuate = function evacuate(){
console.log("" + this.name + " would like a little privacy...");
};
function farmAnimal(name, tehFarm){
Animal.call(this, name);
this.tehFarm = tehFarm;
};
farmAnimal.prototype = Object.create(Animal.prototype);
farmAnimal.prototype.constructor = farmAnimal;
farmAnimal.prototype.talk = function(){
console.log("My name is " + this.name + ", I'm a " + this.tehFarm);
};
farmAnimal.prototype.move = function move(){
console.log(this.name + " the " + this.tehFarm + " is just gonna go over here for a bit");
};
farmAnimal.prototype.eat = function eat(){
console.log(this.name + " the " + this.tehFarm + " is gettin' that food stuffs!");
}
farmAnimal.prototype.poo = function poo(){
console.log(this.name + " the " + this.tehFarm + " is kind of having a private moment right now..." );
}
function petAnimal(name, tehPet){
Animal.call(this, name);
this.tehPet = tehPet;
};
petAnimal.prototype = Object.create(Animal.prototype);
petAnimal.prototype.constructor = petAnimal;
petAnimal.prototype.talk = function(){
console.log("My name is " + this.name + ", I'm a " + this.tehPet);
};
petAnimal.prototype.move = function move(){
console.log(this.name + " " + this.tehPet + " is just gonna go over here for a bit");
};
petAnimal.prototype.eat = function eat(){
console.log(this.name + " the " + this.tehPet + " is stuffing their face!");
}
petAnimal.prototype.poo = function poo(){
console.log(this.name + " the " + this.tehPet +" is just doin that poo thing...." );
}
var baseAnimalOne = new Animal("Phil");
var baseAnimalTwo = new Animal("Larry");
var baseAnimalThree = new Animal("Fitzgerald");
var tehFarmOne = new farmAnimal("Phil", "goose");
var tehFarmTwo = new farmAnimal("Larry", "horse");
var tehFarmThree = new farmAnimal("Fitzgerald", "moo-cow");
var tehPetOne = new petAnimal("Blinkin", "cat");
var tehPetTwo = new petAnimal("Kovu", "dog");
var tehPetThree = new petAnimal("Bubbles", "catfish");
baseAnimalOne.talk();
baseAnimalTwo.walk();
baseAnimalThree.evacuate();
tehFarmOne.move();
tehFarmTwo.eat();
tehFarmThree.poo();
tehPetOne.talk();
tehPetTwo.eat();
tehPetThree.poo();
;