My question is regarding a child object maintaining the prototype chain of its parent object.
In John Resig\'s Advanced Javascript slides (http://ejohn.org/apps/lear
If you don't like the way prototyping works in JavaScript in order to achieve what you need, I'd suggest taking a look at this: https://github.com/haroldiedema/joii
It basically allows you to do the following (and more):
var Employee = new Class(function() {
this.name = 'Unknown Employee';
this.role = 'Employee';
});
var Manager = new Class({ extends: Employee }, function()
{
// Overwrite the value of 'role'.
this.role = 'Manager';
// Class constructor to apply the given 'name' value.
this.__construct = function(name) {
this.name = name;
}
});
var myManager = new Manager("John Smith");
console.log( myManager.name ); // John Smith
console.log( myManager.role ); // Manager