Object Oriented Programming - Reset an Inherited Constructor Property

Tell us what’s happening:

I’m just wondering why there are 3 ObjectName function() {} and no code in the curly braces. I’ve completed all the course and was just wondering why this was as it never says. Is this just for thess exercises or if this how you would see it in programs. Is this just how they are declared as there is no mention as to why there is not code in them. Thanks :slight_smile:

Your code so far

//all completed and correct, just would like some clarification :slight_smile:

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/122.0.0.0 Safari/537.36

Challenge Information:

Object Oriented Programming - Reset an Inherited Constructor Property

They are not filled, it is relying on the names to show the concept of inheritance and how to connect different constructors in a parent/child relationship.
It is relying on the names to say that Animal is parent of Bird and Dog, and showing how to connect them in code

So would this mean that they are never filled in real world programming, and we use names to show the relationship between them?

no, in real world progrqamming they would be filled, and the names would be what makes sense in the context