• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

The Joy of Javascript: prototype inheritance vs classical inheritance

 
Greenhorn
Posts: 27
IntelliJ IDE Ruby Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Luis,
what is the difference between prototype inheritance and classical inheritance? Can you describe it's pros and cons?

Thanks!
 
Ranch Hand
Posts: 102
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Coming from java background I don't have much idea about the various types of inheritance in javascript

I just chanced upon this blog and which has a very interesting take on the javascript inheritance types

webpage


Class Inheritance: instances inherit from classes (like a blueprint — a description of the class), and create sub-class relationships: hierarchical class taxonomies. Instances are typically instantiated via constructor functions with the new keyword. Class inheritance may or may not use the class keyword from ES6.

Prototypal Inheritance: instances inherit directly from other objects. Instances are typically instantiated via factory functions or Object.create(). Instances may be composed of many different objects, allowing for easy selective inheritance.

Good to hear:

Classes: create tight coupling or hierarchies/taxonomies.
Prototypes: mentions of concatenative inheritance, prototype delegation, functional inheritance, object composition.


 
Marshal
Posts: 69410
276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

satya Priya Sundar wrote:. . . I just chanced upon this blog

Well done finding that blog; have a cow

I think, that blog page wrote:. . .
Prototypes: mentions of concatenative inheritance, prototype delegation, functional inheritance, object composition.

Did the blog say what those things mean?
 
If we don't do the shopping, we won't have anything for dinner. And I've invited this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic