KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Please check out the following example: MyBaseClass = function(a) { this.a = a; }; $.extend(MyBaseClass.prototype, { init: function() { console.log('I am initializing the base class'); } }); MyChildClass = $.extend(MyBaseClass, { init: function() { MyBaseClass.prototype.init(); console.log('I am initializing the child class'); } }); var = new MyChildClass(); var.init(); Đ¢his should output both 'I am initializing the base class' and 'I am initializing the child class'. I need to be able to inherit the class MyBaseClass, but still to be able to call his init() method at the beginning of the new init() method. How do I do that?
Tags (comma-separated)
Save Edits
Cancel