提问人:ivanibash 提问时间:5/12/2019 更新时间:5/13/2019 访问量:31
与模块位于同一命名空间/同名下的命名空间类的含义是什么
What are implications of namespacing classes under same namespace/under the same name as a module
问:
如标题所示。我有这个:
module Car
# stuff here
end
class Car::SUV
#stuff here
end
class Car::Hatchback
#stuff here
end
我的类使用模块名称命名这一事实是否有任何影响?它们以相同的名称命名空间这一事实如何?据我了解,这里没有共享任何变量,命名空间类的唯一原因是为了避免名称冲突?
谢谢。
答:
0赞
ivanibash
5/13/2019
#1
正如评论中提到的,问题中描述的命名空间只是命名空间,因此上面是完全独立的模块/类。
评论