template <class T> class First { private: T number; //인트형 넘버 public: First(T); ~First(void); }; template <class T> First<T>::First(T num) { number = num; }
class Second { friend class First<T>; //요기 를 어케써야될지몰겠음.. private: First *st; //first형 포인터 선언하고싶음 int full; public: Second (int); ~Second(void); }; Second::Second(int capacity) { full = capacity; st = new First[full]; //first형 포인터 하고시픔 } Second::~Second() { delete[] st; } void main() { First<int> s(5); }