I am stuck with this code, when I store the address of the the Derived class in Pointer of base class, it shows error, but when made inheritance public there is no error, can anyone help..?
#include <iostream>
using namespace std;
class Base // Created a Class Base
{
public:
void show()
{
cout << "base";
}
};
class Derived: private Base
{
public:
int d;
void display()
{
cout << "derived";
}
};
int main()
{
Base b, *bptr;
Derived d, *dptr;
bptr = &b;
dptr = &d;
bptr->show();
bptr = &d;
bptr->show();
return 0;
}