对象_原型(base、基)

; 创建对象.
thing := {}
; 存储值.
thing.foo := "bar"
; 通过存储函数引用创建方法.
thing.test := Func("thing_test")
; 调用方法.
thing.test()

thing_test(this) {
   MsgBox % this.foo
}

other := {}
other.base := thing
/* 调用 thing.test() 时, thing 会自动被插入到参数列表的开始处. 然而, 为了能够向后兼容, 通过名称 (而不是通过引用) 把函数直接保存到对象中 (而不是继承自基对象) 时这种情况不会发生. 按照约定, 通过结合对象 "类型" 和方法名来命名函数
 */
other.test()
/* 此时, other 从 thing 继承了 foo 和 test. 这种继承是动态的, 所以如果 thing.foo 被改变了, 这改变也会由 other.foo 表现出来. 如果脚本赋值给 other.foo, 值存储到 other 中并且之后对 thing.foo 任何改变都不会影响 other.foo. 调用 other.test() 时, 它 这里的 参数包含到 other 而不是 thing 的引用.
 */
other.foo:="12"
other.test()

给TA捐赠
共{{data.count}}人
人已捐赠
其他

对象_new

2020-3-9 2:16:44

其他

对象中函数的应用

2020-3-9 2:18:44

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索