Object Oriented Programming - Reset an Inherited Constructor Property

This solution seems like it would overwrite the fact that Bird is a subtype of animal. Surely we don’t want this. What am i not understanding?

Your code so far

function Animal() { }
function Bird() { }
function Dog() { }

Bird.prototype = Object.create(Animal.prototype);
Dog.prototype = Object.create(Animal.prototype);

// Only change code below this line

let duck = new Bird();
let beagle = new Dog();


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36 Edg/111.0.1661.41

Challenge: Object Oriented Programming - Reset an Inherited Constructor Property

Link to the challenge:

You can think of it this way: birds and dogs are both animals and even though it isn’t shown here, they have more than a few of the same functions just in the act of being alive. So, the Animal object would have given its functions to both birds and dogs. However, birds and dogs are constructed in different ways so when we go to create a new Bird or Dog, we’d use the specific constructor for the bird or dog and inherit all the rest of the Animal properties.


Okay i understand. thanks

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.