pointer.js 630 B

12345678910111213141516171819202122232425262728
  1. var RTL$ = {
  2. extend: function extend(methods){
  3. function Type(){
  4. for(var m in methods)
  5. this[m] = methods[m];
  6. }
  7. Type.prototype = this.prototype;
  8. var result = methods.init;
  9. result.prototype = new Type(); // inherit this.prototype
  10. result.prototype.constructor = result; // to see constructor name in diagnostic
  11. result.extend = extend;
  12. return result;
  13. }
  14. };
  15. var m = function (){
  16. var T = RTL$.extend({
  17. init: function T(){
  18. this.p = null;
  19. this.i = 0;
  20. }
  21. });
  22. var r = new T();
  23. r.p = new T();
  24. r.p.p = new T();
  25. r.p.i = 123;
  26. }();