#include <stdio.h>
template <typename Type>
void Swap(Type& one, Type& another);
int main()
{
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;
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)
{
template <typename Type>
void Swap( Type&, one, Type& another)
{
Type temp;
temp = one;
one = another;
another = temp;
temp = one;
one = another;
another = temp;
}
'Computer > C++&MFC' 카테고리의 다른 글
WM_SYSCOMMAND 가 보이지 않을떄 (0) | 2008.12.02 |
---|---|
MFC Dialog 기반 OnDraw 적용 (0) | 2008.11.24 |