# How do I implement a MOVE operation using in SystemVerilog? Is it same as move assignment operator in C++? Where can I find an example code?

**URL:** <https://verificationacademy.com/forums/t/how-do-i-implement-a-move-operation-using-in-systemverilog-is-it-same-as-move-assignment-operator-in-c-where-can-i-find-an-example-code/35145>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, systemverilogdeepcopy, OOP-polymorphism-MoveOperation-UVM\
**Created:** [October 6, 2018, 4:39pm UTC](https://verificationacademy.com/forums/t/how-do-i-implement-a-move-operation-using-in-systemverilog-is-it-same-as-move-assignment-operator-in-c-where-can-i-find-an-example-code/35145 "2018-10-06T16:39:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhilash1106](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/abhilash1106/32/3075_2.png) [@abhilash1106](https://verificationacademy.com/forums/u/abhilash1106)\
**Post date:** [October 6, 2018, 4:39pm UTC](https://verificationacademy.com/forums/t/how-do-i-implement-a-move-operation-using-in-systemverilog-is-it-same-as-move-assignment-operator-in-c-where-can-i-find-an-example-code/35145/1 "2018-10-06T16:39:24Z")

</div>

I have been asked this and I have searched everywhere but I never got any code on SystemVerilog.

How do I implement a MOVE operation using in SystemVerilog? Is it same as move assignment operator in C++? Where can I find an example code?

It has something to do with polymorphism I assume.

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [October 6, 2018, 9:16pm UTC](https://verificationacademy.com/forums/t/how-do-i-implement-a-move-operation-using-in-systemverilog-is-it-same-as-move-assignment-operator-in-c-where-can-i-find-an-example-code/35145/2 "2018-10-06T21:16:42Z")

</div>

_In reply to [abhilash1106](https://verificationacademy.com/forums/t/how-do-i-implement-a-move-operation-using-in-systemverilog-is-it-same-as-move-assignment-operator-in-c-where-can-i-find-an-example-code/35145):_

There is no built-in MOVE operator in SystemVerilog, but you can easily add a move() method to any class, or create a parameterized static method’

```verilog
virtual class move#(type T);
 static function T to(inout T from);
    to = from;
    from = null;
 endfunction
endclass

anyclass A, B;

initial begin
          A = new();
          B = move#(anyclass)::to(A);
          ...

```
