先把这个script加到你的页面里:
http://code.google.com/p/doufu/source/browse/trunk/nsc.js
实现一个基础类和继承类:
在上面的类中,我们可以用this.OverrideMethod实现类似Override的功能, 例子
用This.NewProperty实现类似Property 的功能
BaseClassA = function()
{
nsc.OOP.Class(this);
// Create Properties
var _noun = "world";
this.NewProperty("Noun");
this.Noun.Get = function()
{
return _noun;
}
this.Noun.Set = function(value)
{
_noun = value;
}
var _count = 0;
this.NewProperty("Count");
this.Count.Get = function()
{
return _count;
}
this.Count.Set = function(value)
{
_count = value;
}
}
并且在一些特殊情况下,允许直接使用 this.属性名 来取得get方法的返回值:
用this.OverloadMethod实现overload:
this.OverloadMethod("方法名", function()
{
//coding here
});
{
//coding here
});
overload method 的sample代码等等写
站长工具
相关文章

请稍等,评论加载中...