템플릿

7344
points
points
[완료] 템플릿과 일반클래스를 상속한 템플릿 클래스
Submitted by purewell on 수, 2007/05/02 - 4:07pm.template <typename T>
class TParent
{
// blar blar...
};
class CInterface
{
virtual const char* what(void) const = 0;
};
template <typename T>
class TChild : public CInterface, public TParent<typename T>
{
virtual const char* what(void) const
{
return &T;
}
};
7344
points
points
[완료] 템플릿 클래스 내부 타입을 쓰고 싶습니다. (typename)
Submitted by purewell on 월, 2007/04/23 - 7:07pm.#include <iostream>
using namespace std;
template<typename T>
class CTest
{
public:
typedef T type;
type& getWhat(type& t);
};
template<typename T>
CTest<T>::type&
CTest<T>::getWhat(CTest::type& t)
{
return t;
}위 코드에서 아래에 메서드 정의하는 부분에서 에러가 떨어집니다.
