I am from c++ background and I am learning javaScript now. I having trouble understanding polymorphism from javScript's perspective. I understand what is polymorphism how is it implemented i c++ and how it is implemented in javaScript
Polymorphism : Objects of different types responding to method calls at run time, where user is not aware of the type of the object.
Implementation in c++ : We create a base pointer and assign derived class's object to it and then we make a function call using that pointer.:
Implementation in javaScript : we create a function in main function object then we create another function with same name in a function object inherited from the main function object and add them in an array and then execute that array
My doubt is in javaScript we are not making the call based on the parent object. I mean like we have base pointer in c++ and using that we are making the specific function call. I am not sure if I could make myself clear , but would be really thankful if someone could help me