| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2024-6-3 |
| 在线时间 | 55 小时 |
- 梦石
- 0
- 星屑
- 60
- 在线时间
- 55 小时
- 注册时间
- 2011-10-7
- 回帖
- 26
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
求教,我根据《RGSS3教程大家写.pdf》照搬例子,为什么报错……
- class Vector
- attr_reader :X,:y
- @@n = 0
- def self.sum(*vecs)
- x = y = 0
- vecs.each{|v|x+=v.x;y+=v.y}
- Vector.new(x,y)
- end
- def initialize(x,y)
- @x = x
- @y = y
- @@n +=1
- end
- def Vector.report
- @@n
- end
- NULL = Vector.new(0,0)
- end
- a = Vector.new(1,2)
- b = Vector.new(2,4)
- c = Vector.sum(a,b,Vector::NULL)
- msgbox "("+c.x.to_s+","+c.y.to_s+")"
复制代码
|
|