From 916422fa7b420c1d421a777236ac9f090cbb36dd Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Wed, 19 Feb 2025 12:22:18 +0800 Subject: [PATCH] [class.mi] Define ambiguous/unambiguous base class Currently, terms ambiguous base class and unambiguous base class are used without clear definition. The intent seems already clear to me, but perhaps it would be better to properly define them. Co-authored-by: Casey Carter --- source/classes.tex | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/source/classes.tex b/source/classes.tex index a754160838..f907f2d5b9 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -3654,6 +3654,27 @@ \end{importgraphic} \end{note} +\pnum +\indextext{base class!ambiguous}% +\indextext{base class!unambiguous}% +If an object of class \tcode{D} has a single base class subobject of type \tcode{B}, +\tcode{B} is an \defnadj{unambiguous}{base class} of \tcode{D}. +If an object of class \tcode{D} has more than one base class subobject of type \tcode{B}, +\tcode{B} is an \defnadj{ambiguous}{base class} of \tcode{D}. +\begin{example} +\begin{codeblock} +class B { @\commentellip@ }; +class MX : public B { @\commentellip@ }; +class MY : public B { @\commentellip@ }; +class D1 : public MX, public MY { @\commentellip@ }; // \tcode{B} is an ambiguous base class of \tcode{D1} +class D2 : public MX, public B { @\commentellip@ }; // \tcode{B} is an ambiguous base class of \tcode{D2} + +class VMX : virtual public B { @\commentellip@ }; +class VMY : virtual public B { @\commentellip@ }; +class D3 : public VMX, public VMY { @\commentellip@ }; // \tcode{B} is an unambiguous base class of \tcode{D3} +\end{codeblock} +\end{example} + \rSec2[class.virtual]{Virtual functions}% \indextext{function!virtual|(}% \indextext{type!polymorphic}%