Skip to content

Instantly share code, notes, and snippets.

@goofmint

goofmint/index.js

Created Jul 16, 2017
Embed
What would you like to do?
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