i have understand the new() and create() but confuse about their uses.
when and where to use these two.
Does it create any problem if i use new () instead create().
thanks
surya
i have understand the new() and create() but confuse about their uses.
when and where to use these two.
Does it create any problem if i use new () instead create().
thanks
surya
It depends on if you want to use the Factory mechanism, both new() and create() will request memory and finish basic initialization for a specific object, however create() will gave you a object which probably pointed to a derived class.
In reply to caowangyang:
hi caowangyang,
that means in the derived class we don’t need to create the object if we use the create() in main class?
i am new to uvm . please don’t mind if it is an silly question
thanks
surya
In reply to snayak@aimstechnology.inc:
I could gave you an example here.
class a extends uvm_object;
`uvm_object_utils(a)\
......
endclass : a
class b extends class a;
`uvm_object_utils(b)\
......
endclass : b
a = new("a"); // Will just create a object pointed to a
a = a::type_id::create("a"); // Will create a object actually pointed to b if we use something like set_type_override_by_type(a.get_type(), b.get_type());
Hope it helps :)