- Function declarations that differ only by return type. For example,
you cannot declare the following declarations:
int f();
float f();
- Member function declarations that have the same name and the same
parameter types, but one of these declarations is a static member function
declaration. For example, you cannot declare the following two member
function declarations of f():
struct A {
static int f();
int f();
};
- Member function template declarations that have the same name, the same
parameter types, and the same template parameter lists, but one of these
declarations is a static template member function declaration.
- Function declarations that have equivalent parameter declarations.
These declarations are not allowed because they would be declaring the same
function.
- Function declarations with parameters that differ only by the use of
typedef names that represent the same type. Note that a
typedef is a synonym for another type, not a separate type.
For example, the following two declarations of f() are declarations
of the same function:
typedef int I;
void f(float, int);
void f(float I);
- Function declarations with parameters that differ only because one is a
pointer and the other is an array. For example, the following are
declarations of the same function:
f(char*);
f(char[10]);
The first array dimension is insignificant when differentiating
parameters; all other array dimensions are significant. For
example, the following are declarations of the same function:
g(char(*)[20]);
g(char[5][20]);
The following two declarations are not equivalent:
g(char(*)[20]);
g(char(*)[40]);
- Function declarations with parameters that differ only because one is a
function type and the other is a pointer to a function of the same
type. For example, the following are declarations of the same
function:
void f(int(float));
void f(int (*)(float));
- Function declarations with parameters that differ only because of
const and volatile qualifiers. This only applies if
you apply any of these qualifiers appear at the outermost level of an
parameter type specification. For example, the following are
declarations of the same function:
int f(int);
int f(const int);
int f(volatile int);
Note that you can differentiate parameters with const and
volatile qualifiers if you apply these qualifiers within a
parameter type specification. For example, the following declarations
are not equivalent:
void g(int*);
void g(const int*);
void g(volatile int*);
The following declarations are also not equivalent:
void g(float&);
void g(const float&);
void g(volatile float&);
- Function declarations with parameters that differ only because their
default arguments differ. For example, the following are declarations
of the same function:
void f(int);
void f(int i = 10);
- Multiple functions with extern "C" language-linkage and the
same name, regardless of whether their parameter lists are different.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.