Functions and methods can be overloaded if parameter types are declared as in the following example\+:


\begin{DoxyCode}
\textcolor{keywordtype}{int} sub example(\textcolor{keywordtype}{int} $i) \{
    \hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}(\textcolor{stringliteral}{"i=%d\(\backslash\)n"}, $i);
    \textcolor{keywordflow}{return} $i + 1;
\}

\textcolor{keywordtype}{string} sub example(\textcolor{keywordtype}{string} $str) \{
    \hyperlink{group__string__functions_ga32070517a9f8a70a32ef48f83a6f128e}{printf}(\textcolor{stringliteral}{"str=%s\(\backslash\)n"}, $str);
    \textcolor{keywordflow}{return} $str + \textcolor{stringliteral}{"foo"};
\}
\end{DoxyCode}


In this case, the first version ({\ttfamily example(int)}) will be executed if called with an integer argument, and the second ({\ttfamily example(string)}) if called with a string argument.

Class methods may also be overloaded, but note that destructor(), copy(), \hyperlink{qore_classes_methodGate_methods}{method\+Gate()}, \hyperlink{qore_classes_memberGate_methods}{member\+Gate()}, and \hyperlink{qore_classes_memberNotification_methods}{member\+Notification()} methods may not be overloaded (see \hyperlink{qore_classes}{Classes} for more information). 
