SystemVerilog OOP Mastery · All levels

Class Inheritance with `extends`: Interview Questions

Interview Questions for Class Inheritance with `extends`.

Interview questions

Q1. Why does SystemVerilog enforce single inheritance, and how do teams still achieve flexible reuse?

Answer: Single inheritance keeps method lookup and state ownership deterministic. Teams combine one clean base chain with composition and interface-class contracts to reuse orthogonal behavior safely.

Q2. What is the practical risk of not calling super.new in verification classes?

Answer: Base invariants may never be established, so later code sees null handles, missing defaults, or inconsistent metadata. Bugs often appear far from the constructor call site.

Q3. When should you prefer composition over extending another class?

Answer: Prefer composition when the added feature is optional, orthogonal, or potentially shared across unrelated hierarchies. Extend only for a true is-a relationship with shared lifecycle assumptions.

Related topics