Ambiguous Conversions

Explicit and implicit conversions from pointers or references to class types can cause ambiguities. Figure 9.11 shows the following:

The conversion to type A* (pointer to A) is ambiguous because there is no way to discern which subobject of type A is the correct one. Note that you can avoid the ambiguity by explicitly specifying which subobject you mean to use, as follows:

(A *)(B *)&d       // Use B subobject.
(A *)(C *)&d       // Use C subobject.

Figure 9.11   Ambiguous Conversion of Pointers to Base Classes