C++ 템플릿 상속 관련 코드에서 오류를 해결할 수 없습니다.템플릿 및 상속 : "초기화 할 수 없습니다"
template <class row>
struct tableBase
{
typedef row pkeytype;
int k;
};
template <typename row>
struct table:tableBase<typename row::pkeytype>
{
row r;
};
struct astruct {
typedef int pkeytype;
char y;
};
table<astruct> atable;
tableBase<astruct> * u=&atable;
오류 : table<astruct>
의 부모는 두 개의 전혀 관련이없는 유형은 tableBase<int>
하지 tableBase<astruct>
이기 때문이다 초기화
'테이블 *'에 convertable입니다하지'하지만 *'을 tableBase. –
@MooingDuck : structs public public inheritance –