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
[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 <cartec69@gmail.com>
  • Loading branch information
frederick-vs-ja and CaseyCarter committed Feb 19, 2025
commit 916422fa7b420c1d421a777236ac9f090cbb36dd
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy