method.js 866 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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.i = 0;
  19. }
  20. });
  21. var D = T.extend({
  22. init: function D(){
  23. T.prototype.init.call(this);
  24. }
  25. });
  26. T.prototype.p = function(){
  27. this.i = 123;
  28. }
  29. T.prototype.p2 = function(i/*INTEGER*/){
  30. return i;
  31. }
  32. D.prototype.p = function(){
  33. T.prototype.p.call(this);
  34. }
  35. D.prototype.p2 = function(i/*INTEGER*/){
  36. return T.prototype.p2.call(this, i);
  37. }
  38. }();