#javascript-code-05-prototype.js / js
// Create a global object named 'Class' var Class = { // it has a single function that creates a new object constructor create: function() { // Create an anonymous object constructor return function() { // This calls its own initialization method this.initialize.apply(this, arguments); } } } // Add a static method to the Object object which copies // properties from one object to another Object.extend = function(destination, source) { // Go through all of the properties to extend for (property in source) { // and add them to the destination object destination[property] = source[property]; } // return the modified object return destination; }
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.