【发布时间】:2012-03-02 15:34:48
【问题描述】:
有人可以向我解释以下编译器错误吗:
struct B
{
};
template <typename T>
struct A : private T
{
};
struct C : public A<B>
{
C(A<B>); // ERROR HERE
};
指示行的错误是:
test.cpp:2:1: error: 'struct B B::B' is inaccessible
test.cpp:12:7: error: within this context
究竟什么是不可访问的,为什么?
【问题讨论】:
-
与问题无关,这里的C(A)是什么意思?
-
@fizzbuzz:构造函数按值获取
A<B>。 -
@Xeo,哦,是的,A 只是一种类型。
标签: c++ templates inheritance compiler-errors private-inheritance