게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
C++ 함수의 매개변수선언시 조건문을 쓸수 있나요?
게시물ID : programmer_22349짧은주소 복사하기
작성자 : 한시운
추천 : 0
조회수 : 698회
댓글수 : 3개
등록시간 : 2018/04/27 17:59:17
아래와 같은 2개의 함수가 있다고 했을때

void CopyAdd_TsPanel(TsPanel * input, TsGroupBox * Parent, TsPanel ** output) {
TsPanel * buf = new TsPanel(input);
CopyAdd_TsPanel(input, Parent, &buf);
buf->Parent = Parent;
*output = buf;
}

void CopyAdd_TsPanel(TsPanel * input, TsPanel * Parent, TsPanel ** output) {
TsPanel * buf = new TsPanel(input);
CopyAdd_TsPanel(input, Parent, &buf);
buf->Parent = Parent;
*output = buf;
}

위 2함수를 합쳐서


void CopyAdd_TsPanel(TsPanel * input,

 if(Parent->Type == TsPanel
TsPanel * Parent
 else
TsGroupBox * Parent

, TsPanel ** output) {
TsPanel * buf = new TsPanel(input);
CopyAdd_TsPanel(input, Parent, &buf);
buf->Parent = Parent;
*output = buf;
}

위와 같이 매개변수에 조건문으로 선언하는게 가능 할까요?

정확히 똑같지는 안아도 좋으니 뭔가 함수를 합칠수 있는 방법이 있으면 좋겠내요
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호