함수의 중복
#include <iostream>
void function(void){
std::cout<<"function(void) call"<<std::endl;
}
void function(char c){
std::cout<<"function(char c) call"<<std::endl;
}
void function(int a, int b){
std::cout<<"function(int a, int b) call"<<std::endl;
}
int main(void)
{
function();
function('a');
function(1, 2);
return 0;
}
디폴트 매개변수
#include <iostream>
int function(int a=0){
return a+1;
}
int main(void)
{
std::cout<<function(11)<<std::endl;
std::cout<<function()<<std::endl;
return 0;
}
#include<iostream>
int BoxVolume(int length, int width=1, int height=1);
int main()
{
std::cout<<"[3, 3, 3] : "<<BoxVolume(3, 3, 3)<<std::endl;
std::cout<<"[6, 6, def] : "<<BoxVolume(6, 6)<<std::endl;
std::cout<<"[9, def, def] : "<<BoxVolume(9)<<std::endl;
return 0;
}
int BoxVolume(int length, int width, int height)
{
return length*width*height;
}
'컴퓨터 > Software' 카테고리의 다른 글
자바 설치시 환경변수 추가 (0) | 2012.11.27 |
---|---|
[C++] 입력 및 출력 (0) | 2011.11.01 |
[파워포인트] 2개의 파일 합치기 (0) | 2011.10.30 |
Filezilla(파일질라) 에서 한글이 깨져서 보일때 해결방법 (0) | 2011.09.05 |
cubase(큐베이스) synsoacc.dll 에러 해결 (0) | 2011.09.04 |
VMware 의 MAC Address 변경하기 (0) | 2011.08.31 |
진수변환 10 -> 2 -> 8 & 16 (0) | 2011.08.25 |
Netlimiter ; 프로그램이 사용하는 네트워크 대역폭 감시, 제한 (0) | 2008.11.21 |
Network Stumbler (0) | 2008.11.21 |