SystemVerilog OOP Mastery · All levels
Virtual vs Nonvirtual Traps: Interview Questions
Interview Questions for Virtual vs Nonvirtual Traps.
Interview questions
Q1. Why can a derived override be correct but never execute?
Answer: Because dispatch depends on the base declaration. If base method is nonvirtual, calls via base handles bind statically to base implementation.
Q2. What coding guideline prevents most dispatch traps?
Answer: Classify methods as extension points or utilities. Make extension points virtual in base; keep utilities nonvirtual and documented as final behavior.