タグ

2012年8月14日のブックマーク (2件)

  • DrPetter's homepage - sfxr

    This is a little tool I made in connection with the 10th Ludum Dare competition held in December 2007. Its original purpose was to provide a simple means of getting basic sound effects into a game for those people who were working hard to get their entries done within the 48 hours and didn't have time to spend looking for suitable ways of doing this. The idea was that they could just hit a few but

  • JavaScriptの継承を実装する | 仮ぶろぐ

    JavaScriptには継承の機能が無い(代わりにプロトタイプチェーンを使用して同等の機能を実現する)わけですが、一つ自分好みの継承関数を実装してみたいと思います。 ソース:inherit.js 前提はこれくらいでしょうか オーバーライド時に継承元の関数が呼び出せる 多階層の継承が出来る C++でのvirtualな呼び出しが出来る C++やC#をずっと使ってきた自分にとってはプロトタイプチェーンだけではVB6のClassのような残念感があります。 やはりポリモーフィズムやオーバーライドが出来ないと逆に不便です。 色々な継承パターンを調べてみましたが、extendパターンが自分向きのようです。 まずは単純なextend関数 function extend(s, c) { function f(){}; f.prototype = s.prototype; c.prototype = new