class B
  def b1
    p a1
    p "B#b1"
  end
end

class A < B
  def a1
    p "A#a1"
  end
end

o = A.new
o.b1

Program output:

"A#a1"
nil
"B#b1"

Question 1:

What is generating the nil in the output?

Question 2:

Why does B#b1 recognize A#a1?

My C++ background has reared its ugly head and I am now
confused (easily accomplished these days) on what I thought
I understood about Ruby classes.

I re-read Chapter 19 in Programming Ruby, but could not
find an explanation of a super class' method recognizing a
base class' method. I am not clear why this is valid (C++
code would choke in the compile phase). I assume it has
something to do with how instances are constructed in Ruby,
but you know what happens when you assume.

Thanks in advance.