SystemVerilog OOP Mastery · All levels
Abstract Classes with `virtual class`: Concept Explained
Concept Explained for Abstract Classes with `virtual class`.
Concept
In short: A `virtual class` is an abstract base: it can carry shared state/behavior, but it cannot be constructed directly.
Use `virtual class` when you want a strong architectural boundary: all real objects must be specific derived types, but common data, utility methods, and protocol hooks stay centralized in one base definition.
This is especially useful in verification frameworks where multiple protocol variants share infrastructure. You keep one inheritance chain for reusable implementation, while forcing concrete classes to represent real runtime behavior.