Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Use polymorphism through a base handle

Hardware interview practice

Use polymorphism through a base handle

EasySystemVerilogSystemVerilog

A base transaction declares virtual method kind(). A derived error transaction overrides it, and a base-class handle refers to the derived object. Which implementation runs when base_handle.kind() is called?

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Choose one

Answer choices

  1. A. The base implementation, because method selection always follows the handle's declared type.
  2. B. Both implementations in source order, because an override automatically calls super.kind().
  3. C. The derived override, because virtual dispatch follows the object's runtime type.
  4. D. Neither implementation, because a base handle cannot refer to a derived object without copying it.
Continue practicing

Related questions

SystemVerilogUse checked down-casting in SystemVerilog→
asic.fyi · Learn silicon end to end.info@asic.fyi