SystemVerilog OOP Mastery · All levels

`super`, `super.new`, and Overriding Rules

Use super.new for constructor chaining and super.method in overrides when base side effects must be retained; constructors are not polymorphic dispatch points.

Overview

Use super.new for constructor chaining and super.method in overrides when base side effects must be retained; constructors are not polymorphic dispatch points.

super references the immediate parent implementation. In constructors, calling super.new establishes base-class state before derived initialization. This is especially important in UVM components where parent constructors connect the object to hierarchy metadata and factory registration assumptions.

In this topic

diagram
1. Concept Explained
2. Code Examples
3. SystemVerilog vs C++/Java
4. Pitfalls
5. Exercises
6. Interview Questions

Read the concept first, study the code examples, compare against C++/Java, then test yourself with the exercises and interview questions.

Inheritance hierarchy and substitution

diagram
INHERITANCE TREE

                  +-------------------+
                  | class component   |
                  +---------+---------+
                            |
               +------------+-------------+
               |                          |
     +---------v---------+      +---------v---------+
     | class driver      |      | class monitor     |
     +---------+---------+      +-------------------+
               |
     +---------v---------+
     | class axi_driver  |
     +-------------------+

Up-cast is legal: component c = new axi_driver();
Dynamic dispatch picks the most-derived virtual method.

Related topics