你真的理解instance_eval, class_eval和define_method吗?

2011-04-22 14:09:05 +08:00
 daqing
https://gist.github.com/936136

请问a, b, c, d四个方法,分别是实例方法,还是类方法呢?
6138 次点击
所在节点    Ruby
2 条回复
iwinux
2011-04-29 05:31:06 +08:00
a 是 Class 的类方法
b 是 Test 的类方法
c 是 Test 的实例方法
d 是 Test 的类方法

https://gist.github.com/947384
lychee
2011-04-29 08:06:06 +08:00
- - 来学习下 前两天正好在纠结这几个函数

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/11941

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX