i have a few questions involving what and what isnt inherited from base classes.
this basically just pertains to access modifiers. lets say i have a class like this
1 2 3 4 5 6 7 8 9 10 11
class base_class
{
int randomVariable;
protected:
int var1, var2;
public:
int function()
{
return var1 * var2;
}
};
if i then create a class derived from this and change its access modifier to private so the derived class looks like this:
1 2 3 4 5 6 7 8 9
class derived_class:private base_class
{
int variable;
public:
int anotherFunction()
{
return variable * 2;
}
};
then would the derived class have access to the private members of the base_class? the same for protected and public, if i change the derived_classes modifier what will it gain or lose access too?