I saw the below declaration in some program.
class Animal::Cat < Animal
What do these double colons mean?
Does it mean that the Cat class is in the Animal namespace?
Otherwise, the class name itself is Animal::Cat?
I saw the below declaration in some program.
class Animal::Cat < Animal
What do these double colons mean?
Does it mean that the Cat class is in the Animal namespace?
Otherwise, the class name itself is Animal::Cat?
It's another (I think neater) way of writing:
module Animal
class Cat
end
end
Alternatively, if you were in the class Dog and saw:
class Dog
def new_cat
::Cat.new
end
end
You would know you were talking about the Cat class, and not the Dog::Cat class