Here the object of derived class d cannot call the protected member function of the class base.
#include <iostream>
using namespace std;
class base
{
protected:
    int i,j;
    void setij(int a,int b)
    {
        i=a;
        j=b;
    }
    void showij()
    {
        cout<<i<<" "<<j<<endl;
    }
};
class derived : protected base
{
    int k;
public:
    void show()
    {
        base b;
        b.setij(10,20);
        b.showij();
    }
};
int main()
{
    base b;
    derived d;
    d.setij(3,4);
    d.showij();
    d.show();
    return 0;
}
I expect the output is 10 20, but the compiler is showing error.
 
     
     
    