herencia
javascript
JavaScript
function A() {
this.value = 1;
}
A.prototype.decir = function() {
alert('dice ' + this.value);
};
var a = new A();
a.decir();
function B() {
this.value = 2;
}
B.prototype = new A();
var b = new B();
b.decir();
function A() {
this.value = 1;
}
A.prototype.decir = function() {
alert('dice ' + this.value);
};
var a = new A();
a.decir();
function B() {
this.value = 2;
}
B.prototype = new A();
var b = new B();
b.decir();