Skip to content

Commit a78f644

Browse files
burblebeetkoeppe
authored andcommitted
CWG2662 Example for member access control vs. overload resolution
1 parent e326276 commit a78f644

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

source/classes.tex

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4270,6 +4270,19 @@
42704270
access control is applied to it, not to the declarations that replace it.
42714271
For an overload set, access control is applied only to
42724272
the function selected by overload resolution.
4273+
\begin{example}
4274+
\begin{codeblock}
4275+
struct S {
4276+
void f(int);
4277+
private:
4278+
void f(double);
4279+
};
4280+
4281+
void g(S* sp) {
4282+
sp->f(2); // OK, access control applied after overload resolution
4283+
}
4284+
\end{codeblock}
4285+
\end{example}
42734286
\begin{note}
42744287
Because access control applies to the declarations named, if access control is applied to a
42754288
\grammarterm{typedef-name}, only the accessibility of the typedef or alias declaration itself is considered.

0 commit comments

Comments
 (0)