edit-article
Home
Up
Delete
Article Name:
Article Description:
An article looking at js's prototypal inheritance versus classical inheritance used on other programming languages
Chapter ID/Name:
Status:
Write
Writing
Written
Add Photo:
Owner ID:
Content:
use HTML
Edit Content
<h1 style="text-align: center;">prototypal inheritance VS classical inheritance</h1> <h2>[WHAT]</h2> <ol> <li><strong>] prototypal inheritance VS classic al inheritance </strong></li> <ol> <li>] 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</li> <li>] classical inheritance is used in many common programming languages like c++, java</li> </ol> <li><strong>] classical inheritance - has 2 seperate/distinct entities for object creation and object usage,</strong></li> <ol> <li><strong>] the 'class'</strong> - 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 </li> <li><strong>] the 'instance' - </strong>work with 'an instance' of the class - your object variable - a single instance of the var, EX var don = new Person()</li> </ol> <li><strong>] prototypal inheritance -</strong></li> <ol> <li>] Prototypal inheritance is all about objects. <span style="background-color: #00ff00;">Objects inherit properties from other objects. That's all there is to it.</span></li> <li>] Constructors never come into the picture. </li> <li>] ??? The "constructor pattern" of prototypal inheritance. Unfortunately JavaScript uses the constructor pattern of prototypal inheritance ???</li> <li><span style="text-decoration: line-through;">? is Crafting your own constructors for producing custom objects,</span></li> <li><span style="text-decoration: line-through;">? also sets up prototypal inheritance for "your object()"instances.,</span></li> <li> There are two ways of creating objects using prototypal inheritance:</li> </ol></ol> <h2><strong>[WHY reasons]</strong> </h2> <ol> <li>] prototypal pros</li> <li>] prototypal cons</li> <li>] classical pros</li> <li>] classical cons</li> </ol> <h2>[WHERE]</h2> <ol> <li>]</li> </ol> <h2>[WHEN]</h2> <ol> <li>]</li> </ol> <h2>[HOW TO]</h2> <ol> <li>]</li> </ol> <h2>[EXAMPLE]</h2> <ol> <li><strong>] prototypal inheritance ( crockford v1)</strong></li> <ol> <li>] example</li> </ol> <li><strong>] classical inheritance</strong></li> <ol> <li>] example</li> </ol></ol> <h2>[HOW-TO]</h2> <ol> <li>]</li> </ol> <h2>[REFERENCE]</h2> <ol> <li>] <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Details_of_the_Object_Model" target="_blank">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Details_of_the_Object_Model</a> - JavaScript MDN</li> <ol> <li>] Class based VS prototype based languages</li> </ol> <li>] 2013 q <a href="http://stackoverflow.com/questions/19633762/classical-inheritance-vs-protoypal-inheritance-in-javascript">http://stackoverflow.com/questions/19633762/classical-inheritance-vs-protoypal-inheritance-in-javascript</a></li> <ol> <li>] motorcyle example</li> </ol> <li>] 2010 q <a href="http://stackoverflow.com/questions/2800964/benefits-of-prototypal-inheritance-over-classical">http://stackoverflow.com/questions/2800964/benefits-of-prototypal-inheritance-over-classical</a></li> <ol> <li>] a 2013 -</li> </ol></ol> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p>