Question: ```
#include <iostream>
using namespace std;

class A {
    public:
        A ();
        virtual ~A();
};

class B: protected A {
    public:
        virtual ~B ();
};

int main() {
    A* pb = new B;//A is inaccessable base of B
    return 0;
}

```

when I run the code above, it tells me A is inaccessable base of B, the pb is a pointer, which pointer to the B, what is the problem?

Answer: 
Class B derives from class A, but marks it as being protected.
This means that only subclasses of B 'see' that B derives from A.

Since the main routine is not a subclass of B, it only sees B, not that B derives from A.
Therefore, you can't cast a B-pointer to an A-pointer.

To solve it, change it to this:

```
class B: public A {
public:
    virtual ~B ();
};

```
Derive `B` from `public A`, not `protected A`:

```
class B: public A
{
public:
    virtual ~B ();
};

```