title: What is ruby partial class?
body: <p>I read that the code snippet below implements what is called <em>partial class</em>:</p>
  
  <pre><code>class A
    def a
      puts 'a'
    end
  end
  
  class B &lt; A
    def ba1
      puts 'ba1'
    end
  end
  
  class A
    def b
      puts 'b'
    end
  end
  
  class B &lt; A
    def ba2
      puts 'ba2'
    end
  end
  
  ob = B.new
  ob.a
  ob.b
  ob.ba1
  ob.ba2
  </code></pre>
  
  <p>There are two classes <code>B</code> extended from two classes <code>A</code>. I don't understand how ruby could know which <code>A</code> the <code>B</code> is extend from. When creating an instance of <code>B</code>, how does ruby know which <code>B</code> it is? The execution result is:</p>
  
  <pre><code>a
  b
  ba1
  ba2
  </code></pre>
  
  <p>The initialized <code>B</code> is an instance of two <code>B</code> classes. Can someone explain this?</p>