What does the double column “::” mean in:
class XML::Attributes
Is it
- A class
- A method.
- Part of the definition of a class.
- A further namespace inside a class?
What does the double column “::” mean in:
class XML::Attributes
Is it
It’s a namespace separator, which separates the diff namespaces a type/const is in.
module Foo
class Bar
BAR = "BAR"
end
end
class Baz
module SomeMod
record SomeStruct
end
end
Foo::Bar.new
Foo::Bar::BAR # => "BAR"
Baz::SomeMod::SomeStruct.new
Also, if you do class XML::Attributes
and XML
wasn’t defined before, it’s defined as a module.
I suppose, the idea is to regroup related classes under one hood, using modules as namespaces (somehow like std:: in C++)?