Suppose I have the following code:
class A
    {
    public:
        void foo() const {}
    };
    class B : protected A
    {
    public:
    void print() const
    {
        foo();
    }
    };
    void main()
    {
    B b;
    b.print();
    b.foo();
    }
Now, by reading Difference between private, public, and protected inheritance, I conclude that in case of protected inheritance, every public member of the base (for that matter - class A) will be acsessible in the derived class (class B).
However, I dont understand why the command     b.foo(); is not allowed in this case, becuase it  apparently  seems to be allowed according to the rules of protected inheritance.
 
     
    