In reply to shahkavish77:
You are correct that only one object gets created, but the type of that object class b, which is extended from class a. When you extend a class type from another class type, that new class type contains everything in both classes. So when you construct an object of a class b type, both int i member variables get allocated. Which i variable you access depends on the class variable used to reference the object.
Please see my SystemVerilog OOP course, especially the second session on inheritance.