JS用函数原型摸拟面向对象。。很怪异。。
摘要:
function Parent(id, name) //定义父类{this._id = id; //定义对象属性this._name = name;if (typeof Customer._init == "undefined"){Customer.prototype.Say = function() //定义对向方法,只执行一次{alert("my name is " + this._name);}Customer._init = true;}}function ChildCustomer(id, name) //定义子类{Customer.call( 阅读全文
posted @ 2011-03-31 13:24 炼炁修士 阅读(146) 评论(0) 推荐(0) 编辑