Below is my base class:
Vehicle
{
protected: //members being inherited
public:
void getDetails();
};
This is my derived class:
class Car : protected Vehicle
{}
now I am trying to access the public function of base class through my derived class object. according to my understanding the public functions of base class are inherited by the derived class, so it should work.
Car obj2;
obj2.getDetails(); /*Public func of base class*/
But I am getting error like: 'Vehicle::getDetails' not accessible because 'Car' uses 'protected' to inherit from 'Vehicle'
Can someone explain this? what i am missing?