Herencia JS
by paska
JavaScript
window.Taw3 = {};
window.Taw3.Widget = function () {
(function (self, $, undefined) {
self.Id;
self.Constructor = function(id) {
self.Id = id;
};
self.SayHello = function() {
alert("hello from widget: " + self.Id);
self.SayGoodBye();
};
self.SayGoodBye = function() {
alert("generic goodbye");
};
}(this, jQuery));
if (jQuery.isFunction(this.Constructor)) {
this.Constructor.apply(null, arguments);
this.Constructor = undefined;
}
};
window.Taw3.AccesosDirectos = function (id) {
Taw3.Widget.call(this, id);
(function (self, $, undefined) {
self.Links;
self.Msg;
self.Constructor = function(id, msg) {
self.Links = ["Google", "Yahoo"];
self.Msg = msg;
};
self.SayGoodBye = function() {
alert(self.Msg + self.Id);
};
}(this, jQuery));
if (jQuery.isFunction(this.Constructor)) {
this.Constructor.apply(null, arguments);
this.Constructor = undefined;
}
};
var acc = new Taw3.AccesosDirectos("idABC", "goodbye from widget: ");
// alert(acc.Id);
// alert(acc.Links);
// acc.SayHello();
acc.SayHello();