Javascript-OOPs(Part3)-Inheritance - (9)
👉 Javascript with OOPs (Inheritance) In Javascript, Inheritance is done using prototype object. A prototype object is an object pointing to another object. We don't have a direct inheritance in Javascript, we can mimic inheritance using prototype. Let's say, we have one more class that inherits from Customer, and it submits to Server2. function CustomerChild(){ this.submit = function() { alert ("this submits the data to Server2" + " " + this.CustomerName + " " + this.CustomerCode"); }} CustomerChild.prototype = new Customer(); var cust = new Customer(); cust.CustomerName ("John"); cust.Submit(); --this is a call to the submit method of the Customer class. cust = new CustomerChild(); cust...





Comments
Post a Comment