title: Not able to access constant from parent class in ruby
body: <p>I am trying to access the constant from parent class but getting error</p>
  
  <p><strong>NameError: uninitialized constant CONSTS</strong></p>
  
  <p>This is my code - parent class</p>
  
  <pre><code>module Abc
    class Xyz
      class A
        class CONSTS
          ONE = "1"
          TWO = "2"
          Three = "3"
        end
      end
    end
  end
  </code></pre>
  
  <p>This is the child class </p>
  
  <pre><code>module Abc
    class Xyz
      class B &lt; A
        class &lt;&lt; self
          def print_const
            get_const
          end
  
          private
  
          def get_const
            puts CONSTS::ONE
          end
        end
      end
    end
  end
  </code></pre>
  
  <p>Now, when i try Abc:Xyz::B.print_const i am getting the above error.</p>
  
  <p>can anyone tell me where i am doing wrong?</p>