I read that declaring object methods in prototype is good approach because it saves memory and allows to change implementation in any time for all objects. But what i need to do when i need to set base object for object that uses prototype method declaration? Example:
function Animal() {
this.age = 0;
this.weight = 0;
//other properties
}
Animal.prototype = {
//some methods for Animal
}
function Dog() {
//properties for Dog
}
Dog.prototype = {
//some methods for Dog
}
So, how can i set Animal as a base class(object) for Dog(because prototype property in Dog is implemented as custom object for methods)?