<mySearch ⁄>
<myBlog show="last" ⁄>
<myPhoto order="random" ⁄>
<mySnippets order="rand" ⁄>
<mySnippets type="lang" ⁄>
<myQuote order="random" ⁄>Quando se descobre a necessidade interior de outra pessoa, consegue-se entender todas as suas ações.
<myContacts ⁄><email ⁄>
<windows live messenger ⁄>
<myCurriculum type="pdf" ⁄>
<myVisitorsMap ⁄>JavaScript as a prototypical language offers loads of solutions to implement classes and class inheritance. When coming from an Object Oriented language such as Java or Ruby, these solutions aren't obvious at the first glance.
I started coding JavaScript years ago and always found a solution for my specific case. But things felt messy and I always thought "Is this really the right way of doing it?". Well, after all those years, experience took away this feeling and now I want to share some stuff that finally meant a break-through of understanding for me.
There are two different concepts of doing inheritance in JavaScript. One is using the prototype property of a function as a mean to create something similar to a "class". The other concept is using the constructor function itself to create a class dynamically during runtime.
For both concepts I'll show you their basic idea and compact helpers for creating inheritance in an elegant way.
Let's start with the prototype-based concept.
este é só um excerto do artigo, para aceder ao artigo completo, clique no link em baixo:
this is just a small excerpt from the article, to access the full article please click in the link below:
http://www.ruzee.com/blog/2008/12/javascript-inheritance-via-prototype...
<myNews show="rand" cat="programacao" ⁄>