View Full Version : JavaScript | prototypal inheritance vs. classical inheritance

12-29-2010, 08:27 AM
What are the benefits of prototypal inheritance over classical inheritance?

12-29-2010, 08:47 AM
In My Opinion, the major benefit of prototypal inheritance is its simplicity.

The prototypal nature of the language can confuse people who are classically trained, but it turns out that actually this is a really simple and powerful concept, differential inheritance (http://en.wikipedia.org/wiki/Differential_inheritance).

You don't need to make classification, your code is smaller, less redundant, objects inherit from other, more general objects.

If you think prototypically you will soon notice that you don't need classes...

Prototypal inheritance will be much more popular in the near future, the ECMAScript 5th Edition (http://www.ecma-international.org/publications/standards/Ecma-262.htm) specification introduced the Object.create method, which allows you to produce a new object instance that inherits from another one in a really simple way:

var obj = Object.create(baseInstance);
This new version of the standard is being implemented by all browser vendors, and I think we will start to see more pure prototypal inheritance...

Warm Regards,
Aby Varghese
Director at AMT (http://www.amt.in)

12-29-2010, 12:36 PM
What are the benefits of prototypal inheritance over classical inheritance?

why you post twice? this is confusing. Please ask one of the moderators to join this thread with http://www.codingforums.com/showthread.php?t=213444

best regards and happy holidays

rnd me
12-29-2010, 08:05 PM
return ["<",a,">",this,"</",a,">"].join("");

"this is a text phrase".split("").reverse(

//==<span>ESARHP TXET A SI SIHT</span>