Should I call create() or new() for the transaction with my transaction class?

I have an UVM transaction class called ( txn_A ) then I have another transaction class called ( txn_B). In (txn_B) I have an array of (txn_A), should I use new() or create() to construct those array of transactions?

In reply to DVCoder:

If you want to create a dynamic arry of any type including class types you have to use the constructor new. Thwe dynamic array does not know the create from the factory.

In reply to chr_sue:

In reply to DVCoder:
If you want to create a dynamic arry of any type including class types you have to use the constructor new. Thwe dynamic array does not know the create from the factory.

Then for a static/fixed size array there is no need to call the new constructor since it is already allocated?

In reply to DVCoder:

That’s correct for the array, but you have to construct the lements of the array. For this construction the create method of the factory is recommended.

In reply to chr_sue:

The information from chr_sue is incorrect. There is a difference between constructing a dynamic array of class variables using the new[size] operator, and constructing the class objects whose handles get stored in each array element by calling the new() constructor method.

You must use the new[] operator or copy from an existing unpacked array to allocate elements of a dynamic array.

You should should always use the create() method instead of the new() method for objects registered with the factory. However, there is some overhead in using the factory, so you may not want to register things you have no intention of ever using factory overrides, like RAL register models, or any other large data structures.