User guide

24-61
SystemVerilog Testbench Constructs
Figure 24-2 Chaining Constructors
when Class_ab is instantiated, the “new” constructor for Class_a is
called. In turn, the “new” constructor for ClassA is called. Since
ClassA is the last super class in the chain, an object of Class_ab is
then created. When Class_b is instantiated, the “new” constructor for
ClassA is called and an object of Class_b is created.
This process is called “chaining constructors.”
If the initialization method of the super-class requires arguments,
you have two choices. If you want to always supply the same
arguments, you can specify them at the time you extend the class:
class EtherPacket extends Packet(5);
Base Class
Subclass
ClassA
Class_a
Class_ab
Class_b