Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/lolipop.jp-dp07276078/web/blog/wp/wp-includes/cache.php on line 36

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/lolipop.jp-dp07276078/web/blog/wp/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/lolipop.jp-dp07276078/web/blog/wp/wp-includes/theme.php on line 508
blog.cori95.net : Javascriptのクラスの継承

2005/10/06

Javascriptのクラスの継承

さて、ぬる~くJavascript書いてみてますが、何気に継承の仕方が分からないということに気づいた…
で、メモ。とりあえずprototype.js の Object.extendってのを使えばいい模様。
interfaceとかそういうのはないのかしら???

var Person = Class.create();
Person.prototype = {
	initialize : function() {},
	hello:  function() {alert('Hello!!')}
}

var Jap = Class.create();
Jap.prototype = (new Person).extend({
    hello:  function() {alert('こんにちわ')},
});
[2007-10-03 追記]
このエントリはかつて Blosxom 用に書いたものをスクリプトで自動変換したものです。真面目に確認していないので,デザインの崩れやリンク切れが残っています場合にはご容赦ください。

Posted at 02:57:38|個別ページJavaScriptトラックバックURL||
はてなブックマークに追加! この記事をLivedoorクリップ! Yahoo!ブックマークに追加! del.icio.usに追加! ニフティクリップに追加! Buzzurlに追加! このページを POOKMARK Airlines の行き先に登録する BlogPeople Instant Bookmark に追加! newsing it!に追加! PingKingポッケに追加!

トラックバックURL

トラックバック URL :

コメント(1) »

  1. JavaScriptの配列

      複数の値をまとめて扱う場合に1〓2つ程度であれば前回の記事で説明したように変数を使用すれば問題ないとおもいます。
    しかし扱う
    (…続く…)

コメントをどうぞ

HTML convert time: 0.065 sec. Powered by WordPress ME