User guide

24-44
SystemVerilog Testbench Constructs
The output of this program is:
The value of q is 4.
If a property is not initialized by the constructor, it is implicitly
initialized, just like any other variable, with the default value of its data
type.
Assignment, Re-naming and Copying
Consider the following:
class Packet;
...
endclass
Packet p1;
Packet p1; creates a variable, p1, that can hold the handle of an
object of class Packet. The initial default value of p1 is null. The
object does not yet exist, and p1 does not contain an actual handle,
until an instance of type Packet is created as shown below:
p1 = new(); //if no arguments are being passed, () can be
//omitted. e.g., p1=new;
Another variable of type Packet can be declared and assigned the
handle, p1 to it as shown below:
Packet p2;
p2 = p1;
In this case, there is still only one object. This single object can be
referred to with either variable, p1 or p2.