• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

The Joy of Javascript: prototype inheritance vs classical inheritance

 
Greenhorn
Posts: 26
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: 73
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: 64710
226
  • 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?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!