O'Reilly logo

JavaScript Object Programming by Martin Rinehart

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 8

image

Designing for JavaScript

We chose the JSWindows project because it was well-suited to class-based inheritance. Consider the inheritance chain for the window-closing button.

Button_close    Button        Rect            Wobj

Clearly, the window-closing button is a specialized instance of the generic Button. Equally clearly, the Button is a specialized Rect and the Rect is one of the objects you need to show on the screen, a specialized window object. At least this part of JSWindows fits very well into a class-based OOP inheritance hierarchy. (Not by accident. That’s why we chose the project.)

But the question remains, given the material ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required