Listing 8 A base class (B) with a protected member (j) and a private member (k)

class B
       {
protected:
       int j;
private:
       int k;
       };

class D : public B
       {
public:
       int foo();
       };

int D::foo()
       {
       ++j;      // ok
       return k; // error: k not accessible
       }
/* End of File */