Timeline for How prototypal inheritance is practically different from classical inheritance?
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 14, 2012 at 12:49 | comment | added | Roel | But how are these differences 'important'? I don't see constructing objects by calling a function, not using 'new', as 'important', just a small syntax difference. Likewise, not having private variables isn't fundamentally different, just a small difference. Plus, you can have (something similar to) private variables, in the way you describe. | |
| Aug 9, 2011 at 0:34 | comment | added | Bjorn | It's not something I'd ever do, I'm just saying it is possible to call the constructor over and over again with JavaScript but not in languages with traditional classes. | |
| Aug 8, 2011 at 19:54 | comment | added | Sean McMillan | This is a very strange pattern you're using there. Circle.call() as a constructor? It looks like you're trying to describe "functional objects" (a misnomer...) | |
| Aug 7, 2011 at 23:27 | comment | added | Bjorn | It's true, you can, but you can't do it without creating a bunch of 'public' methods added to the context that are created every time you create an instance. | |
| Aug 7, 2011 at 22:14 | comment | added | Raynos | You can extend the "class" meaningfully. You just can't access the local variables color, r, x, y and drawCircle that are bound to the lexical scope of Circle | |
| Aug 7, 2011 at 19:22 | history | answered | Bjorn | CC BY-SA 3.0 |