/ Published in: JavaScript
Expand |
Embed | Plain Text
function A() { //private members var x; //getter this.getX = function() { return x; } //setter this.setX = function(newX) { x = newX; } } A.prototype.DoIt = function(data) { console.log(data); } B.prototype = new A();// Define sub-class B.prototype.constructor = B; function B() { A.call(this); } B.prototype.DoIt = function(data) { A.prototype.DoIt.call(this, data); console.log(data); } var i = new B();
You need to login to post a comment.
