cplusplus.com cplusplus.com
cplusplus.com   C++ : Forums : Articles : Inheritance Rules
  Search:
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forums
Forums
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Articles
Lounge
Jobs

-

post  Inheritance Rules

amro (1)

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, amro_ja@hotmail.com.
| Last edited on

This topic is archived - New replies not allowed.
Home page | Privacy policy
© cplusplus.com, 2000-2008 - All rights reserved - v2.2
Spotted an error? contact us