[C++] 01 - 2 : 함수 오버로딩(Function Overloading)
2023. 3. 13. 16:52ㆍChlln's Code/C++
함수 오버로딩의 예
FunctionOverloading.cpp
#include <iostream>
using namespace std;
void MyFunc(void) {
cout << "Myfunc(void) called" << endl;
}
void MyFunc(char c) {
cout << "Myfunc(char c) called" << endl;
}
void MyFunc(int a, int b) {
cout << "Myfunc(int a, int b) called" << endl;
}
int main(void) {
MyFunc();
MyFunc('A');
MyFunc(12, 13);
return 0;
}
출력 결과
Myfunc(void) called
Myfunc(char c) called
Myfunc(int a, int b) called
'Chlln's Code > C++' 카테고리의 다른 글
[C++] 문제 01 - 3 [매개변수의 디폴트값] (2) | 2023.03.13 |
---|---|
[C++] 01 - 3 : 매개변수의 디폴트값(Default Value) (0) | 2023.03.13 |
[C++] 문제 01 - 2 [함수 오버로딩] (0) | 2023.03.13 |
[C++] 문제 01 - 1 [C++ 기반의 데이터 입출력] (2) | 2023.03.13 |
[C++] 01 - 1 : printf와 scanf를 대신하는 입출력 방식 (0) | 2023.03.13 |