Shallow and deep copy

HI All,

consider the class/general example like this:

class A;
    integer i = 1;

  class B;
    integer j = 1;
    A obj_a = new;

B b1, b2;
  1. object assignment
    b1 = new;
    b2 = b1;

  2. shallow copy
    b1= new;
    b2 = new b1;

  3. deep copy
    b1= new;
    b2 = new;

Query: Where all these 3 will be used?
I searched in few websites, could not find the application of all these.
I wanted to understand more, where these kind of copy statments are used?
can you please give one or two examples?

Thank You,

Object assignment gets used when calling a method. It’s how assignments are made to method arguments.

Shallow copy and deep copy are concepts that in practice get blended together. I suggest you take a look at my SystemVerilog OOP course on classes.