Inheritance Rules


class person
{
int ID;
protected:
int salary;
public :
string name;
};

class employee : access_specifior person
{
int num;
public :
string employment;
};

when u wanna make inheritance to a class the shared members of the base class will have 2 access specifiors in the derived class :
1- The first which it took from the base class.


2- The 2nd which it took from the derived class (how it inherits).



and it takes the higher security of them by the order :
1- private
2- protected
3- public



Amro Awad, JUST university, [email protected].
Last edited on
Topic archived. No new replies allowed.