Skip to content

Commit 88a0a64

Browse files
committed
Update classical-inherit.js
1 parent aa96c54 commit 88a0a64

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

classical-inherit.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,18 @@ function inherit(C, P){
7777
}
7878

7979
// minuses: copies only prototypes.
80-
}
80+
81+
82+
// classical inherit # (preferred way)
83+
84+
85+
var inherit = (function(){
86+
var F = functuion() {};
87+
return function(C, P){
88+
F.prototype = P.prototype;
89+
C.prototype = new F();
90+
C.uber = P.prototype;
91+
C.prototype.constructor = C;
92+
}
93+
})
94+

0 commit comments

Comments
 (0)