开发者

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

开发者 https://www.devze.com 2023-04-03 08:40 出处:网络
This question already has answers here: Closed 11 years 开发者_如何学JAVAago. Possible 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

精彩评论

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