相关疑难解决方法(0)

涉及私有继承的C++编译器错误

有人可以向我解释以下编译器错误:

struct B
{
};

template <typename T>
struct A : private T
{
};

struct C : public A<B>            
{                                                                             
    C(A<B>);   // ERROR HERE
};
Run Code Online (Sandbox Code Playgroud)

指示行的错误是:

test.cpp:2:1: error: 'struct B B::B' is inaccessible
test.cpp:12:7: error: within this context
Run Code Online (Sandbox Code Playgroud)

究竟什么是难以接近的,为什么?

c++ inheritance templates compiler-errors private-inheritance

6
推荐指数
1
解决办法
274
查看次数