2 ms·
Inheritance can be a bit tricky to fit in, as I recall, but it's quite elegant to implement basic classes and objects with just closures.
by acjohnson55 14y ago
Inheritance can be a bit tricky to fit in, as I recall, but it's quite elegant to implement basic classes and objects with just closures.
- pjscott 14y agoA very simple and elegant way to handle inheritance is to give each object a pointer to another object -- let's call it "prototype" -- and delegate any failed member variable or method lookups to the prototype. This is how JavaScript's object system works.