article

classical inheritance

[WHAT]

  1. ]

[WHY]

[WHERE]

  1. ]

[WHEN]

  1. ]

[EXAMPLE]

  1. ] Vehicle = function(){
  2. }
  3. ] var myCar = new Vehicle(mfg,type,color)  // inheirits from vehicle.prototype

[HOW-TO]

  1. ]

[REFERENCE]

  1. ] http://javascript.crockford.com/inheritance.html - Five years ago I wrote Classical Inheritance 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.
  2. ] Dean Edward's Base.js, Mootools's Class or John Resig's Simple Inheritance works are ways to do classical inheritance in JavaScript.

 


Vehicle{

 - type:

- mfg:

- color:

- wheels:

- start(){}

- stop(){}

- drive(){}

}

 

Car :: Vehicle{

- doors:

-wipersOn()

- wipersOff()

}

 

Motorcycle::Vehicle{

-kickStart()

}

 

Details Photos Edit more

Details

ID: 2744

NAME: 006-classical-inheritance

DESCRIPTION: An article looking at classical inheritance

AUTHOR: article.author/s

EDITOR: article.editor/s

PUBLISHER: article.publisher/s

STATUS: Write

PRIORITY: -5

OWNER ID: 75

Content Photos Edit more

photos

page_photo

actions

Email Email-Owner SMS and