开发者

What is significant about the "::" notation? [duplicate]

This question already has answers here: Closed 11 years 开发者_如何学JAVAago.

Possible Duplicate:

What is Ruby's double-colon (::) all about?

What is the "::" telling me in this code example? I'm working thru the ruby koans and don't fully understand this code chuck.

class ::Integer
  def even?
    (self % 2) == 0
  end
end


It's going to the root namespace.


It's the namespace resolution operator.

This S/O question has more detail:

What is Ruby's double-colon `::`?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜