JavaScript Objects and Inheritance revisited

Over two years ago I developed the xbObject in order to code JavaScript Object Oriented scripts using inheritance. Although xbObject achieved the goals I originally set, it's implementation could be improved using features of the ECMAScript 262 3rd Edition. This note will revisit JavaScript Objects, Inheritance and xbObjects to see if xbObjects still is relevant or if an alternative approach would be more useful.

This note assumes you already understand the basics of using JavaScript and JavaScript Objects. The Netscape DevEdge JavaScript 1.5 Reference and JavaScript 1.5 Guide provide the necessary background for understanding JavaScript objects.

xbObject Goals

To illustrate the ideas, I will use a class modelled after the C++ class hierarchy:

      class myParentClass
      {
        public:
        myParentClass(char *n) { name = n;};
        void method() { };
        char* name;
      }

      class myChildClass : public myParentClass
      {
        public:
        myChildClass(char *n) : name(n) {};
        void method() { };
      }
   

home | up | topabout: