Created
July 16, 2017 15:30
-
-
Save goofmint/bbcd3696ac477fcb7f64499de28cc757 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AnimalClass = h5.cls.RootClass.extend(function (super_) { | |
return { | |
// クラス名(完全修飾名) | |
name: 'AnimalClass', | |
// クラスのフィールド定義 | |
field: { | |
_name: null | |
}, | |
// クラスのメソッド定義 | |
method: { | |
constructor: function (params) { | |
// 親クラスのコンストラクタ呼び出し | |
super_.constructor.call(this); | |
this._name = params; | |
}, | |
hello: function() { | |
return this._name; | |
}, | |
cry: function(name, voice) { | |
return name + "'s crying voice is " + voice; | |
} | |
} | |
}; | |
}); | |
var DogClass = AnimalClass.extend(function (super_) { | |
return { | |
name: 'DogClass', | |
field: { | |
_voice: { | |
defaultValue: 'bow wow' | |
} | |
}, | |
method: { | |
constructor: function (params) { | |
super_.constructor.call(this, params); | |
}, | |
cry: function() { | |
return super_.cry(this._name, this._voice); | |
} | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment