What is done internally by tool we call new constructor.?

Hi, I am beginner in UVM.
Let’s consider a case where I have two classes as mentioned below.

class a;                            class b;
   int x;                                int y;
endclass                          endclass

module top;
   a ah;
   b bh;
   initial begin
       ah = new();

Here what happends internally when the new constructer is called…?

  1. How will the tool know that the new constructer is for the class a only…?
  2. How will the execution happen left to write or right to left.

The new constructer does the following
Initially the new construct will create the object and then the object address is allocated to the handels the finally the default values are initialised.

But how does the tool know exactely that it is belonging to the class a , is it based on the handel…?

As per my understanding, Before creating object for any handle, we have declared that handle, belongs to which class. Whenever creating object using new, it will create object as per the handle datatype, that is class a in your example, and handle is pointing to the address of object created, and object will have all properties and methods of the class a, for which ah handle is declared.

See my Short class on SystemVerilog classes.