# New() and create()

**URL:** <https://verificationacademy.com/forums/t/new-and-create/30465>\
**Category:** UVM\
**Tags:** UVM, create-and-new\
**Created:** [March 17, 2015, 6:11am UTC](https://verificationacademy.com/forums/t/new-and-create/30465 "2015-03-17T06:11:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![snayak.aimstechnology.inc](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/58f4c7/32.png) [@snayak.aimstechnology.inc](https://verificationacademy.com/forums/u/snayak.aimstechnology.inc)\
**Post date:** [March 17, 2015, 6:11am UTC](https://verificationacademy.com/forums/t/new-and-create/30465/1 "2015-03-17T06:11:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![caowangyang](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/caowangyang/32/2164_2.png) [@caowangyang](https://verificationacademy.com/forums/u/caowangyang)\
**Post date:** [March 17, 2015, 8:56am UTC](https://verificationacademy.com/forums/t/new-and-create/30465/2 "2015-03-17T08:56:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![snayak.aimstechnology.inc](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/58f4c7/32.png) [@snayak.aimstechnology.inc](https://verificationacademy.com/forums/u/snayak.aimstechnology.inc)\
**Post date:** [March 17, 2015, 9:13am UTC](https://verificationacademy.com/forums/t/new-and-create/30465/3 "2015-03-17T09:13:25Z")

</div>

_In reply to [caowangyang](https://verificationacademy.com/forums/t/new-and-create/30465/2):_

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

---

<div class="post-metadata">

**Author:** ![caowangyang](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/caowangyang/32/2164_2.png) [@caowangyang](https://verificationacademy.com/forums/u/caowangyang)\
**Post date:** [March 17, 2015, 12:01pm UTC](https://verificationacademy.com/forums/t/new-and-create/30465/4 "2015-03-17T12:01:13Z")

</div>

_In reply to [snayak@aimstechnology.inc](https://verificationacademy.com/forums/t/new-and-create/30465/3):_

I could gave you an example here.

```verilog

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 :)
