edit-article
Home
Up
Delete
Article Name:
Article Description:
An article looking at classical inheritance
Chapter ID/Name:
Status:
Write
Writing
Written
Add Photo:
Owner ID:
Content:
use HTML
Edit Content
<h1 style="text-align: center;">classical inheritance</h1> <h2>[WHAT]</h2> <ol> <li><strong>] </strong></li> </ol> <h2>[WHY]</h2> <ol> <li>] </li> </ol> <h2>[WHERE]</h2> <ol> <li>]</li> </ol> <h2>[WHEN]</h2> <ol> <li>]</li> </ol> <h2>[EXAMPLE]</h2> <ol> <li>] Vehicle = function(){</li> <li>}</li> <li>] var myCar = new Vehicle(mfg,type,color) // inheirits from vehicle.prototype</li> </ol> <h2>[HOW-TO]</h2> <ol> <li>]</li> </ol> <h2>[REFERENCE]</h2> <ol> <li>] <a href="http://javascript.crockford.com/inheritance.html" target="_blank">http://javascript.crockford.com/inheritance.html</a> - Five years ago I wrote <a href="http://javascript.crockford.com/inheritance.html">Classical Inheritance</a> in JavaScript. It showed that JavaScript is a class-free, prototypal language, and that it has sufficient expressive power to simulate a classical system. My programming style has evolved since then, as any good programmer's should. I have learned to fully embrace prototypalism, and have liberated myself from the confines of the classical model.</li> <li>] Dean Edward's <a href="http://code.google.com/p/base2/" target="_blank">Base.js</a>, <a href="http://mootools.net/docs/core/Class/Class" target="_blank">Mootools's Class</a> or <a href="http://ejohn.org/blog/simple-javascript-inheritance/" target="_blank">John Resig's Simple Inheritance</a> works are ways to do classical inheritance in JavaScript.</li> </ol> <p> </p> <hr /> <p>Vehicle{</p> <p> - type:</p> <p>- mfg:</p> <p>- color:</p> <p>- wheels:</p> <p>- start(){}</p> <p>- stop(){}</p> <p>- drive(){}</p> <p>}</p> <p> </p> <p>Car :: Vehicle{</p> <p>- doors:</p> <p>-wipersOn()</p> <p>- wipersOff()</p> <p>}</p> <p> </p> <p>Motorcycle::Vehicle{</p> <p>-kickStart()</p> <p>}</p> <p> </p>