title: Create object within class definition
body: <p>I want to crate an instance of <code>ClassB</code> inside <code>ClassA</code>, and assign it to variable <code>@test3</code>.</p>
  
  <p>This is my code:</p>
  
  <pre><code>module A
    module B
      class ClassA &lt; Hash
        @test1 = Hash.new()
        @test2 = Object.new()
        @test3 = A::B::ClassB.new()
  
        def initialize(_name, _config = {})
          puts _name
          puts _config
          super()
        end
      end
  
      class ClassB &lt; Hash
        def initialize(_config = {}, _parent = nil)
          puts _config
          puts _parent
          super()
        end
      end
    end
  end
  </code></pre>
  
  <p>It is possible to set <code>@test3</code> within the <code>initialize</code> method, but I have reasons not to do so. <code>@test1</code> and <code>@test2</code> work, but I get an error:</p>
  
  <pre><code>NameError: uninitialized constant A::B::ClassB
  </code></pre>
  
  <p>Why does this not work?</p>