language: C++ 4.7.2 (gcc-4.7.2)
date: 620 days 18 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
 
using namespace std;
 
class A
{
   protected:
    void f() { cout << "A::f()" << endl; }
};
 
class B : private A {};
 
class C : B 
{
  public:
         C() { f(); } //A::f is inaccessible
};
 
int main() {
        C c;
        return 0;
}
prog.cpp: In constructor ‘C::C()’:
prog.cpp:8: error: ‘void A::f()’ is protected
prog.cpp:16: error: within this context
prog.cpp:8: error: ‘void A::f()’ is protected
prog.cpp:16: error: within this context
prog.cpp:16: error: ‘A’ is not an accessible base of ‘C’