SystemVerilog OOP Mastery · All levels

Abstract Classes with `virtual class`: Pitfalls

Pitfalls for Abstract Classes with `virtual class`.

Pitfalls and red flags

  • Trying to instantiate a `virtual class` directly with `new`.

  • Putting protocol-specific behavior in the abstract base, making subclasses harder to reason about.

  • Forgetting to call `super.new(...)` in derived classes when the base constructor has required arguments.

  • Using one giant abstract base for unrelated responsibilities instead of splitting contracts and helpers.

Related topics