article

prototypal inheritance VS classical inheritance

[WHAT]

  1. ] prototypal inheritance VS classic al inheritance
    1. ] prototypal inheritance is a method of inheritance we (should/could) use in the javascript programming language to create new objects by 'inheriting' charactistics of existing objects
    2. ] classical inheritance is used in many common programming languages like c++, java
  2. ] classical inheritance - has 2 seperate/distinct entities for object creation and object usage,
    1. ] the 'class' - A class is the 'template' for 'an object' that defines the object instances properties and methods(behaviour), objects use constructor methods to create new instances of the object  
    2. ] the 'instance' - work with 'an instance' of the class - your object variable - a single instance of the var, EX var don = new Person()
  3. ] prototypal inheritance -
    1. ] Prototypal inheritance is all about objects. Objects inherit properties from other objects. That's all there is to it.
    2. ] Constructors never come into the picture. 
    3. ] ??? The "constructor pattern" of prototypal inheritance. Unfortunately JavaScript uses the constructor pattern of prototypal inheritance ???
    4. ? is Crafting your own constructors for producing custom objects,
    5. ? also sets up prototypal inheritance for "your object()"instances.,
    6.  There are two ways of creating objects using prototypal inheritance:

[WHY reasons]  

  1. ] prototypal pros
  2. ] prototypal cons
  3. ] classical pros
  4. ] classical cons

[WHERE]

  1. ]

[WHEN]

  1. ]

[HOW TO]

  1. ]

[EXAMPLE]

  1. ] prototypal inheritance ( crockford v1)
    1. ] example
  2. ] classical inheritance
    1. ] example

[HOW-TO]

  1. ]

[REFERENCE]

  1. ] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Details_of_the_Object_Model - JavaScript  MDN
    1. ] Class based VS prototype based languages
  2. ] 2013 q http://stackoverflow.com/questions/19633762/classical-inheritance-vs-protoypal-inheritance-in-javascript
    1. ] motorcyle example
  3. ] 2010 q http://stackoverflow.com/questions/2800964/benefits-of-prototypal-inheritance-over-classical
    1. ] a 2013 -

 

 

 

 

 

Details Photos Edit more

Details

ID: 2742

NAME: 007-prototypal-inheritance-vs-classical

DESCRIPTION: An article looking at js's prototypal inheritance versus classical inheritance used on other programming languages

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