SwVitaliy

Untitled

May 8th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Base(){}
  2. >undefined
  3. Base.prototype.init = function() {
  4. this.a='1';
  5.  
  6. }
  7. >function () {
  8. >this.a='1';
  9. >
  10. >}
  11. Base.prototype.create = function(config) {
  12. this.init(config);
  13. return this;
  14. }
  15. >function (config) {
  16. >this.init(config);
  17. >return this;
  18. >}
  19. function Child(){}
  20. >undefined
  21. extend = function(Child, Parent)
  22.     {
  23.         var F = function() { };
  24.         F.prototype = Parent.prototype;
  25.         Child.prototype = new F();
  26.         Child.prototype.constructor = Child;
  27.         Child.super = Parent.prototype;
  28.     };
  29. >function (Child, Parent)
  30. >   {
  31. >        var F = function() { };
  32. >        F.prototype = Parent.prototype;
  33. >        Child.prototype = new F();
  34. >        Child.prototype.constructor = Child;
  35. >        Child.super = Parent.prototype;
  36. >    }
  37. extend(Child, Base)
  38. >undefined
  39. >Child.prototype
  40. F
  41. Child.super
  42. >Base
  43. function Child2(){}
  44. >undefined
  45. extend(Child2, Child)
  46. >undefined
  47. Child2
  48. >function Child2(){}
  49. Child2.super
  50. >F
  51. >constructor: function Child(){}
  52. >__proto__: Base
Advertisement
Add Comment
Please, Sign In to add comment