参见文章
function CShape(int ax, int ay) {
var _this = this ; // 把this保存下来,以后用_this代替this,这样就不会被this弄晕了
_this.x = 0; // 公有属性
_this.y = 1;
var mx = 0; // 私有属性
var my = 1;
this .draw = function () // 公有方法
{
}
var draw1=function() // 私有方法
{
}
var init = function() // 构造函数
{
_this.x = ax;
_this.y = ay;
}
init();
}
var shp = new CShape(1, 2);
shp.draw();