Overloading 이란,
Overloading 의 조건
함수 오버로딩의 예
// 매개변수의 타입 일치 X
int function(int n){...}
int function(char c){...}
// 매개변수의 개수 일치 X
int function1(int v){...}
int function2(int v1, int v2){...}
함수 오버로딩 사용 시 주의할 점
디폴트 매개변수란?
디폴트 매개변수 사용 시 주의할 점
디폴트 매개변수 예
void addNum1(int a, int b)
{
cout << a << " + " << b << " = " << a + b << endl;
}
void addNum2(int a, int b = 99)
{
cout << a << " + " << b << " = " << a + b << endl;
}
void addNum3(int a = 1, int b = 99)
{
cout << a << " + " << b << " = " << a + b << endl;
}