템플릿을 이용하여 일반화된 클래스 구현


템플릿을 이용하여 일반화된 클래스 구현

<구현 전 기본 코드> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 #include <iostream> using std::cout; using std::endl; class CCC1 { int x; int y; public: CCC1(int xx, int yy) { x = xx; y = yy; } void Print() { cout << x << ',' << y << endl; } }; class CCC2 { double x; double y; public: CCC2(double xx, double yy) { x = xx; y = yy; } void Print() { cout << x << ',' << y << endl; } }; class CCC3 { char x; const char* y; public: CCC3(char xx...



원문링크 : 템플릿을 이용하여 일반화된 클래스 구현