S
srinivas.singanamalla
Can anyone help here?
I have two classes, Rect and RoundRect.
RoundRect is a subclass of Rect
mstr.chart.Rect = (function(){
function Rect(x, y, w, h) { /* this is the class constructor */
this.x = x;
this.y = y;
this.w = w;
this.h = h;
};
Rect.prototype.toString = function() {
var str = 'x, y: (' + this.x + ',' + this.y + ') w, h : (' +
this.w + ', ' + this.h + ')';
return str;
}
return Rect; })();
mstr.chart.RoundRect = (function() {
function RoundRect(x,y,w,h,arc) {
mstr.chart.Rect.apply(this, arguments);
this.arc = arc;
}
RoundRect.prototype.toString = function() {
return 'testing directly';
}
RoundRect.prototype = new mstr.chart.Rect();
return RoundRect;
})();
-----------------------------------------------------------------------------
When I alert on toString method of RoundRect, it shows me Rect's
toString. What am I doing wrong here?
var myRect = new mstr.chart.RoundRect (0, 0, 2, 2, 0.2);
alert(tooltipRect.toString());
Thanks,
Srini
I have two classes, Rect and RoundRect.
RoundRect is a subclass of Rect
mstr.chart.Rect = (function(){
function Rect(x, y, w, h) { /* this is the class constructor */
this.x = x;
this.y = y;
this.w = w;
this.h = h;
};
Rect.prototype.toString = function() {
var str = 'x, y: (' + this.x + ',' + this.y + ') w, h : (' +
this.w + ', ' + this.h + ')';
return str;
}
return Rect; })();
mstr.chart.RoundRect = (function() {
function RoundRect(x,y,w,h,arc) {
mstr.chart.Rect.apply(this, arguments);
this.arc = arc;
}
RoundRect.prototype.toString = function() {
return 'testing directly';
}
RoundRect.prototype = new mstr.chart.Rect();
return RoundRect;
})();
-----------------------------------------------------------------------------
When I alert on toString method of RoundRect, it shows me Rect's
toString. What am I doing wrong here?
var myRect = new mstr.chart.RoundRect (0, 0, 2, 2, 0.2);
alert(tooltipRect.toString());
Thanks,
Srini