前回の続きです。サンプルコードは前回から続いていると思ってください。 privateは諦めましょう 親のメソッドを呼ぶ コンストラクタ instanceofに対応する ダックタイピングのススメ 今回もobject関数を使うので再掲載。 /* * object - オブジェクトを作る * Object object(BaseObj [, mixinObj1 [, mixinObj2...]]) */ function object(o) { var f = object.f, i, len, n, prop; f.prototype = o; n = new f; for (i=1, len=arguments.length; i<len; ++i) for (prop in arguments[i]) n[prop] = arguments[i][prop]; return n; } ob
![newを封印して、JavaScriptでオブジェクト指向する(2)](https://cdn-ak-scissors.b.st-hatena.com/image/square/126e9c63960837b5815901e11e1f6c1303c17f2b/height=288;version=1;width=512/https%3A%2F%2Fblog.seesaa.jp%2Fimg%2Fogp_logo.png)