Micah Snyder씨는 jQuery에서 사용할 수 있는 OO(Object-Oriented) 클래스를 사용하게 해주는 라이브러리를 만들었습니다. 마치 Prototype처럼요. 저같은 사람이 또 있었군요. 워~ "super"도 호출합니다.
var Foo = Class.create({
fooz: function() {
console.log('fooz of Foo');
}
});
var Bar = Class.create(Foo.prototype, {
fooz: function() {
this.sup();
console.log('fooz of Bar');
}
});
var Baz = Class.create(Bar.prototype, {
fooz: function() {
this.sup();
console.log('fooz of Baz');
}
});
개인적으로는 OO 스러운 코딩을 흉내내고 싶다면 아싸리 Prototype을 쓰는 쪽이 이롭다고 생각합니다.
Comments
Got something to add? You can just leave a comment.
Your Reaction Time!