In reply to Shubhabrata:
Yes, that is the correct approach although a little bit more complicated than it needs to be.
You know that $typename(a) is 'A" because that is the way you declared it.
There is no need to bring UVM into this, you are not even supposed to how these classes are declared. uvm_object’s get_type_name is a virtual method, it always returns the extended type name of the object.