Member function declarations with
the same name,
the same parameter-type-list (
[dcl.fct]), and
the same trailing
requires-clause (if any)
cannot be overloaded if any of them is a
static
member function declaration (
[class.static])
. Likewise, member function template declarations with
the same name,
the same parameter-type-list,
the same trailing
requires-clause (if any), and
the same
template-head
cannot be
overloaded if any of them is a
static
member function template declaration
. The types of the implicit object parameters constructed for the member
functions for the purpose of overload resolution (
[over.match.funcs])
are not considered when comparing parameter-type-lists for enforcement of
this rule
. In contrast, if there is no
static
member function declaration among a set of member function
declarations with
the same name,
the same parameter-type-list, and
the same trailing
requires-clause (if any),
then
these member function declarations can be overloaded if they differ in
the type of their implicit object parameter
. [
Example 1:
The following illustrates this distinction:
class X {
static void f();
void f();
void f() const;
void f() const volatile;
void g();
void g() const;
void g() const volatile;
};
—
end example]