When doing ob.a, you get the variable int a from your ob object, which is object of the class B.
However, when you do ob.get();, you are calling the get()-method from class A, because there is no get() in B, which - as you wrote - uses this.a, which would be the int a of class A in that case.