// define a module var Vulnerable = { wound: function(hp) { this.health -= hp;alert(;this.health)if (this.health < 0) this.kill(); }, kill: function() { this.dead = true; } };
var Display = {
};
// the first argument isn't a class object, so there is no inheritance ...
// simply mix in all the arguments as methods:
var Person = Class.create(Vulnerable, Display {
initialize: function() {
this.health = 100;
this.dead = false;
}
});
But this.healt is undefined.
Is it possible to do that ?
Thank
| // define a module var Vulnerable = { |
|
wound: function() { alert(this.health); |
} }; // the first argument isn't a class object, so there is no inheritance ... // simply mix in all the arguments as methods: |
| var Person = Class.create(Vulnerable,{ |
initialize: function() { this.health = 100; |
| }, test : function() { Vulnerable.wound(); } }); |
var a = new Person(); |
| a.test(); //undifined Is that, I like to do. |
--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.To post to this group, send email to prototype-s...@googlegroups.com.
To unsubscribe from this group, send email to prototype-scripta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to prototype-scriptaculous+unsub...@googlegroups.com.