Why there is an error in the following example?
class ClassA
class ClassB
end
class ClassC
def test
ClassB.new
end
end
end
p ClassA::ClassC.new.test # => #<ClassA::ClassB:0x0000010103f860>
class ClassA
class ClassD
def test
ClassB.new
end
end
end
p ClassA::ClassD.new.test # => #<ClassA::ClassB:0x0000010103f010>
class ClassA::ClassE
def test
ClassB.new
end
end
p ClassA::ClassE.new.test # => NameError: uninitialized constant ClassA::ClassE::ClassB
Is there another way to create ClassE
, not by typing class ClassA; class ClassE
?