<s>
In	O
the	O
C++	B-Language
programming	I-Language
language	I-Language
,	O
dominance	B-Application
refers	O
to	O
a	O
particular	O
aspect	O
of	O
C++	B-Language
name	B-Application
lookup	I-Application
in	O
the	O
presence	O
of	O
Inheritance	B-Language
.	O
</s>
<s>
When	O
the	O
compiler	O
computes	O
the	O
set	O
of	O
declarations	O
to	O
which	O
a	O
particular	O
name	O
might	O
refer	O
,	O
declarations	O
in	O
very-ancestral	O
classes	O
which	O
are	O
"	O
dominated	O
"	O
by	O
declarations	O
in	O
less-ancestral	O
classes	O
are	O
hidden	O
for	O
the	O
purposes	O
of	O
name	B-Application
lookup	I-Application
.	O
</s>
<s>
In	O
other	O
languages	O
or	O
contexts	O
,	O
the	O
same	O
principle	O
may	O
be	O
referred	O
to	O
as	O
"	O
name	O
masking	O
"	O
or	O
"	O
shadowing	B-Language
"	O
.	O
</s>
<s>
The	O
algorithm	O
for	O
computing	O
name	B-Application
lookup	I-Application
is	O
described	O
in	O
section	O
10.2	O
 [ class.member.lookup ] 	O
of	O
the	O
C++11	B-Language
Standard	O
.	O
</s>
<s>
The	O
Standard	O
's	O
description	O
does	O
not	O
use	O
the	O
word	O
"	O
dominance	B-Application
"	O
,	O
preferring	O
to	O
describe	O
things	O
in	O
terms	O
of	O
declaration	O
sets	O
and	O
hiding	O
.	O
</s>
<s>
However	O
,	O
the	O
Index	O
contains	O
an	O
entry	O
for	O
"	O
dominance	B-Application
,	O
virtual	B-Application
base	I-Application
class	I-Application
"	O
referring	O
to	O
section	O
10.2	O
.	O
</s>
<s>
In	O
the	O
above	O
example	O
,	O
Child::g	O
contains	O
a	O
reference	O
to	O
the	O
name	O
f	O
.	O
However	O
,	O
the	O
program	O
as	O
a	O
whole	O
contains	O
four	O
declarations	O
of	O
the	O
name	O
f	O
.	O
In	O
order	O
to	O
figure	O
out	O
which	O
f	O
is	O
meant	O
,	O
the	O
compiler	O
computes	O
an	O
overload	B-Language
set	O
containing	O
all	O
the	O
declarations	O
which	O
are	O
not	O
hidden	O
at	O
the	O
point	O
of	O
the	O
call	O
.	O
</s>
<s>
The	O
declaration	O
of	O
f	O
at	O
global	O
scope	O
is	O
hidden	O
by	O
Grandparent::f	O
,	O
and	O
in	O
turn	O
Grandparent::f	O
is	O
hidden	O
by	O
Parent::f	O
.	O
Thus	O
the	O
only	O
declaration	O
which	O
is	O
considered	O
by	O
overload	B-Language
resolution	I-Language
is	O
Parent::f	O
—	O
and	O
the	O
result	O
in	O
this	O
case	O
is	O
a	O
diagnostic	O
,	O
because	O
the	O
call-site	O
provides	O
two	O
arguments	O
where	O
Parent::f	O
expects	O
only	O
one	O
.	O
</s>
<s>
It	O
is	O
often	O
surprising	O
to	O
new	O
C++	B-Language
programmers	O
that	O
the	O
declaration	O
of	O
Parent::f	O
dominates	O
and	O
hides	O
all	O
of	O
the	O
more-ancestral	O
declarations	O
,	O
regardless	O
of	O
signature	O
;	O
that	O
is	O
,	O
Parent::f(int )	O
dominates	O
and	O
hides	O
the	O
declaration	O
of	O
Grandparent::f(double, double )	O
even	O
though	O
the	O
two	O
member	O
functions	O
have	O
very	O
different	O
signatures	O
.	O
</s>
<s>
It	O
is	O
also	O
important	O
to	O
observe	O
that	O
in	O
C++	B-Language
,	O
name	B-Application
lookup	I-Application
precedes	O
overload	B-Language
resolution	I-Language
.	O
</s>
<s>
If	O
Parent::f	O
had	O
multiple	O
overloads	B-Language
(	O
for	O
example	O
f(int )	O
and	O
f(double, double )	O
)	O
,	O
the	O
compiler	O
would	O
choose	O
between	O
them	O
at	O
overload-resolution	O
time	O
;	O
but	O
during	O
the	O
name-lookup	O
phase	O
we	O
are	O
concerned	O
only	O
with	O
choosing	O
among	O
the	O
three	O
scopes	O
Grandparent::f	O
,	O
Parent::f	O
,	O
and	O
::f	O
.	O
The	O
fact	O
that	O
Grandparent::f(double, double )	O
would	O
have	O
been	O
a	O
better	O
overload	B-Language
than	O
f(int )	O
is	O
not	O
part	O
of	O
the	O
compiler	O
's	O
consideration	O
.	O
</s>
<s>
In	O
the	O
above	O
example	O
,	O
the	O
compiler	O
computes	O
an	O
overload	B-Language
set	O
for	O
f	O
which	O
contains	O
both	O
Mother::f	O
and	O
Father::Grandparent::f	O
.	O
The	O
compiler	O
produces	O
a	O
diagnostic	O
indicating	O
that	O
the	O
program	O
is	O
ill-formed	O
because	O
the	O
name	O
f	O
is	O
ambiguous	O
.	O
</s>
<s>
Even	O
if	O
Child	O
itself	O
were	O
to	O
inherit	O
virtually	O
from	O
Grandparent	O
,	O
there	O
would	O
be	O
no	O
ambiguity	O
in	O
name	B-Application
lookup	I-Application
.	O
</s>
