Awesome content, man! I really love this playlist. Learning so much from it. But, correct me if I'm wrong, but I think there's a mistake in this video. If you set Employee.prototype to Person.prototype, and you create a person, like let mike = new Person(...), mike will have all the calcSalary() and the empDetails() in the __proto__, even though mike is not an instance of Employee. Plus, if you want to override a method in the Employee.prototype, it will overwrite it in the Person.prototype, as that is what Employee.prototype is referencing. So, it should be Employee.prototype = Object.create(Person.prototype); This way, Employee.prototype still inherits everything from Person.prototype, but it's a separate object.
So...this means that we can only make one of this type of inheritance "link?" , as in an object constructor child can only be linked to 1 parent's prototype method and not multiple? I get that the parent will always be 1 but what is there to do in the case of an object constructor having the need to take prototype methods from multiple object constructors and writing that line of code twice will simply overwrite the previous line?
Sorry for the late reply. The main use of a class is that, it acts as a blueprint for creating N number of objects. Lets say, you have Employee class which inherits from Person class. Now when you instantiate 100 objects using this employee class, each of them will inherit methods and properties from Person class also. So, here you will save a lot of time using class inheritance. Now let try to do the same thing using objects. So, you have a person object and you want to create 100 employee objects like john, merry, Steve etc. Let's say, these objects should also inherit methods of person object. in order to that, you will have to make each employee inherit from person object one by one explicitly. This is quite cumbersome task right? To make 100 employees inherit from person object. Hope this answered your question. have a great day :)
@@youusef101 I just checked the course you mentioned on my Udemy Personal Plan; they are not exactly the same. I mean the concepts are the same cos the language is the same! But the examples are different. There are similarities, but I am not sure if those similarities justify calling someone a thief, but again, who knows.. I might be wrong. I need to do more of Jonas's content.
Amazing explanation sir🙏🙏..We seriously need this type of soothing simple explanation for Computer Languages
Man, where are you till now. I have 8 years experience in UI development, never saw this much clear explanation. thank you 1/0 times.
Awesome content, man! I really love this playlist. Learning so much from it. But, correct me if I'm wrong, but I think there's a mistake in this video. If you set Employee.prototype to Person.prototype, and you create a person, like let mike = new Person(...), mike will have all the calcSalary() and the empDetails() in the __proto__, even though mike is not an instance of Employee. Plus, if you want to override a method in the Employee.prototype, it will overwrite it in the Person.prototype, as that is what Employee.prototype is referencing.
So, it should be
Employee.prototype = Object.create(Person.prototype);
This way, Employee.prototype still inherits everything from Person.prototype, but it's a separate object.
you are right 🫡
At 17.10 why dont we write Emlpoyee= Object.create(person.prototype).
Great content; thank you SO MUCH.
So...this means that we can only make one of this type of inheritance "link?" , as in an object constructor child can only be linked to 1 parent's prototype method and not multiple? I get that the parent will always be 1 but what is there to do in the case of an object constructor having the need to take prototype methods from multiple object constructors and writing that line of code twice will simply overwrite the previous line?
Thank you 👏
thank you.
subscribed !
Thanks ..sir have u made video on ""super() ""
In the class inheritance lecture, I have covered super() function. You can check it out.
@@procademy thank you... What is difference between class and object inheritance
Sorry for the late reply. The main use of a class is that, it acts as a blueprint for creating N number of objects. Lets say, you have Employee class which inherits from Person class. Now when you instantiate 100 objects using this employee class, each of them will inherit methods and properties from Person class also. So, here you will save a lot of time using class inheritance.
Now let try to do the same thing using objects. So, you have a person object and you want to create 100 employee objects like john, merry, Steve etc. Let's say, these objects should also inherit methods of person object. in order to that, you will have to make each employee inherit from person object one by one explicitly. This is quite cumbersome task right? To make 100 employees inherit from person object.
Hope this answered your question. have a great day :)
@@procademy thanks
Now I hope will be to understand javascript by watching ur videos
Is assigning Employee.prototype = Person.prototype the right way?, Shouldn't it be Employee.prototype.__proto__ = Person.prototype?
This isnt inheritance, this is dependency injection handled through reflection.
Thief
Why thief?!
@@farazk9729 His whole content is stolen from a popular JS course from Jonas Schmedtmann
@@youusef101 wow! Didn't know that
@@youusef101 I just checked the course you mentioned on my Udemy Personal Plan; they are not exactly the same. I mean the concepts are the same cos the language is the same! But the examples are different. There are similarities, but I am not sure if those similarities justify calling someone a thief, but again, who knows.. I might be wrong. I need to do more of Jonas's content.
@@farazk9729 I took the course so I can tell
Thank you 👏