看板 [ Ruby ]
討論串[問題] 請教關於 static method
共 3 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓0(0推 0噓 1→)留言1則,0人參與, 最新作者godfat (godfat 真常)時間17年前 (2008/02/14 01:05), 編輯資訊
0
0
4
內容預覽:
在 c++ 會叫 static method 的原因,大抵上是為了節省 keyword,. 只要讓一個 keyword 有兩種以上的功能,就能夠減少名稱污染。. 在 c 裡,static 大致上是使得被修飾者的 scope 限定在某個範圍,. 如果加在某個 global function/varia
(還有1086個字)

推噓1(1推 0噓 3→)留言4則,0人參與, 最新作者godfat (godfat 真常)時間17年前 (2008/02/13 21:38), 編輯資訊
0
0
4
內容預覽:
在 ruby 請稱之為 class method, static 這個字眼根本不合理. require 'benchmark'. class C. def im; end. def self.cm; end. end. Benchmark.bm{ |bm|. c = C.new. bm.report
(還有669個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者mokuku (mokuku)時間17年前 (2008/02/13 21:28), 編輯資訊
0
0
0
內容預覽:
Ruby 定義 method 時,. 可以用. def self.methodname. end. 來定義 static method. 請教一下,. static method 和 instance method. 哪種比較快阿?. 謝謝!. --. 發信站: 批踢踢實業坊(ptt.cc).
首頁
上一頁
1
下一頁
尾頁