$ cat inheritance.cpp
#include <iostream>
using namespace std;
class A { };
class B : private A { };
int main() {
A* ab = new B;
}
$
$ g++ inheritance.cpp
inheritance.cpp: In function 'int main()':
inheritance.cpp:9: error: 'A' is an inaccessible base of 'B'
$
I just do not understand this error.
As I understand, and as this tutorial confirms, private
inheritance should only change how the members of class B
are visible to the outside world.
I think the private specifier is doing more than just change visibility of class B
members here.