Академический Документы
Профессиональный Документы
Культура Документы
and Class
Hierarchy
Submitted By:
Manish Kumar
MCA 2019
INHERITANCE
17-02-2020 2
BASE---->DRIVE
17-02-2020 3
ADVANTAGE
17-02-2020 4
BASIC SYNTAX--EXAMPLE
class base_class class Account {
{
public:float salary = 60000;
Properties.....
Methods....... };
}; class Programmer: public Account {
class drived_class : visibility_mode base_class public:float bonus = 5000;
{
Properties..... };
Methods....... void main() {
}; Programmer p1;
cout<<"Salary: "<<p1.salary<<end
17-02-2020 l; 5
INHERITANCE VISIBILITY
MODE
• Depending on Access modifier used while inheritance, the availability of class
members of Super class in the sub class changes.
1. Public Inheritance
• the protected member of super class becomes protected members of sub class and
public becomes public.
2. Private Inheritance
• the protected and public members of super class become private members of derived
class.
3. Protected Inheritance
• the public and protected members of Super class becomes protected members of Sub
class.
17-02-2020 6
INHERITANCE
VISIBILITY MODE
17-02-2020 7
TYPES OF INHERITANCE
17-02-2020 8
TYPES OF INHERITANCE
17-02-2020 9
CLASS HIERARCHIES
17-02-2020 10
THANK YOU
17-02-2020 11