hit counter


믹시

Locations of visitors to this page


#include <stdio.h>

template <typename Type>
void Swap(Type& one, Type& another);

int main()
{
int N = 5, M = 10;

Swap(N, M);
printf("N = %d, M = %d\n", N, M);

double dN = 5.0, dM = 10.0;

Swap(dN, dM);
printf("dN = %f, dM = %f\n", dN, dM);

return 0;

}

template <typename Type>
void Swap( Type&, one, Type& another)
{
Type temp;

temp = one;
one = another;
another = temp;
}

크리에이티브 커먼즈 라이선스
Creative Commons License

'Computer > C++&MFC' 카테고리의 다른 글

간단한 템플릿 함수 예제  (0) 2008/12/09
WM_SYSCOMMAND 가 보이지 않을떄  (0) 2008/12/02
MFC Dialog 기반 OnDraw 적용  (0) 2008/11/24
Tag // , ,

댓글을 달아 주세요