Upgrading some Corvettes—Extends versus Implements

Now that we have reviewed some of the reasons to extend versus implement, we are ready to examine more closely how inheritance within Extends can be useful in our scripting.

Getting ready

Create a display area for the output of our manufacturing plant.

<h1>Speeds Before</h1>
<div id="before"></div>
<h1>Speeds After</h1>
<div id="after"></div>

How to do it...

Create two classes, one that represents all car chassis with no engine and one that represents a fast engine that can be ordered as an upgrade. This section is identical to the last recipe; if necessary, review once more before continuing as the jist will be to alter our instantiations to display how inheritance patterns affect them.

// create ...

Get MooTools 1.3 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.