Shallow Copy Methods

Hello All

I have a doubt in Shallow Copy Method in System Verilog…

Following are the two ways i tried Shallow Copy can you please tell me the the difference in two methods what exactly happening in two methods…

Lets assume their is a class packet and pkt_1 and pkt_2 are handles …

1. Usual Method of Shallow copy
packet pkt_1;
pkt_1 = new();
packet pkt_2;
pkt_2 = new pkt_1;

2. Method 2
*packet pkt_1;
pkt_1 = new();
packet pkt_2;
pkt_2 = new();
pht_2 = pkt_1;
*

In reply to nayan2208:

Method 2 is not an object copy at all. Please see the first session of my SystemVerilog OOP video.

In reply to dave_59:

Sir can you tell me whats the difference in two what actually happening in both case.

In reply to nayan2208:
I did on slides 12 and 13.