Hardware interview practice
Use polymorphism through a base handle
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?
Choose one
Answer choices
- A. The base implementation, because method selection always follows the handle's declared type.
- B. Both implementations in source order, because an override automatically calls super.kind().
- C. The derived override, because virtual dispatch follows the object's runtime type.
- D. Neither implementation, because a base handle cannot refer to a derived object without copying it.
