KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
My terminology is a bit off, so feel free to correct where necessary. I want to overload a function in javascript and the 'base class' to make use of the overloaded method as well as the inherited class to access the base classes methods. So far, I came up with a (working) mix of jquery.extend() and object literals, but this doesn't look pretty. I was wondering if there's a better way of doing this (can use jquery). var Base = new function(args, m) { $.extend(this, m); var self = this; this.bar = function() { self.foo(); } this.foo = function() { self.blah(); } this.dosomething = function() {} }; var Child = function(arg1) { $.extend(this, new Base(args, { blah: function() { self.dosomething() } })); }
Tags (comma-separated)
Save Edits
Cancel