Several restrictions govern an acceptable set of overloaded functions:
Microsoft Specific
You can overload operator new solely on the basis of return type — specifically, on the basis of the memory-model modifier specified.
END Microsoft Specific
typedef char * PSTR;
void Print( char *szToPrint );
void Print( PSTR szToPrint );
The preceding two functions have identical argument lists. PSTR
is a synonym for type char *. In member scope, this code generates an error.
void Print( char *szToPrint );
void Print( char szToPrint[] );
For multiply dimensioned arrays, the second and all succeeding dimensions are considered part of the type. Therefore, they are used in distinguishing between overloaded functions:
void Print( char szToPrint[] );
void Print( char szToPrint[][7] );
void Print( char szToPrint[][9][42] );