Here's my code:
class Base{
public:
getValue(int a){
x = a;
}
protected:
int x;
};
class Derived: public Base{
public:
Derived():Base(){
Value = 0;
}
void Function();
}
So my confusion comes from the inheritance when you have to set the scope of the Base
function in the derived function, in google it says that everything in the base class becomes public. If that is the case, doesn't the protected value in the Base
function become easily accessible in the Derived
function? isn't that bad?
If this is the case isn't there a way keep the protected value from the base class protected in the derived class.