• 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
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

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: 77
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: 66195
250
  • 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?
 
She said she got a brazillian. I think owning people is wrong. That is how I learned ... tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!