Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "A Base constructor calls a virtual member on *this while constructing a Derived object. Where can that call dispatch?" on CodeWiki (https://codewiki.com/practice/mcq/cpp/virtual-functions/constructor-dispatch-boundary/).
Context (verbatim from the page):
"""
A Base constructor calls a virtual member on *this while constructing a Derived object. Where can that call dispatch?
To the final overrider in Base or one of its bases, not to Derived.
Always to Derived because the allocation already has Derived size.
Only to a free function selected by argument-dependent lookup.
The call is always a compile-time error.
"""
Introduce three subtle bugs into the example above and let me find them. Reveal each answer only after I have guessed.
Answer in English. Keep code examples in C++. Where you are unsure, say so.