Skip to content

[class.mi] Define ambiguous/unambiguous base class #7306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}%
Expand Down