기타 (1) 썸네일형 리스트형 [명품 C++] 11. 템플릿과 STL 예제 10-1 제네릭 myswap( ) 함수 만들기 #include using namespace std; class Circle { int radius; public: Circle (int radius =1) { this -> radius = radius; } int getRadius() { return radius; } }; template void myswap(T &a, T &b) { T tmp; tmp = a; a = b; b = tmp; } int main() { int a=4, b=5; myswap(a,b); cout 이전 1 다음