SlideShare uma empresa Scribd logo
1 de 35
Baixar para ler offline
Kinan keshkeh 
IT Engineering-Damascus University 
3rd year 
Summer course- 2014 
2 bytes team
• 
Who has any Ques? 
• 
So Let’s Go ! 
• 
What we will take : 
• 
See a program for example. 
• 
Inheritance concept 
• 
Some NOTES !!
Inheritance !
Inheritance !
Inheritance 
•is the process by which a new class—known as a derived class—is created from another class, called the base class
Inheritance 
•is the process by which a new class—known as a derived class—is created from another class, called the base class 
•A derived class automatically has all the member variables and all the ordinary member functions that the base class has, and can have additional member functions and additional member variables.
Inheritance 
•We have Parent class “ Vehicle” and child class “ Wheeled vehicle” and child of child “Car” . 
•So each “Car” is a “ Wheeled vehicle” and “Vehicle” .
Inheritance 
•To derive class from base class , we write : class DerivedClass : public BaseClass{ class_members }
Inheritance 
•To derive class from base class , we write : class DerivedClass : public BaseClass{ class_members } 
• A class that is a parent of a parent of a parent of another class, is often called an ancestor class 
• If class A is an ancestor of class B, then class B is often called a descendant of class A
Inheritance 
•The members of the Child classes are members from the Parent classes , so any operation or any function is defined in Parent class , will be defined in Child classes .
Inheritance 
•The members of the Child classes are members from the Parent classes , so any operation or any function is defined in Parent class , will be defined in Child classes . 
•The other way isn’t correct !!
Inheritance 
•Base Class Employee :
Inheritance 
•Base Class Employee :
Inheritance
Inheritance 
•Derived Class HourlyEmployee :
Inheritance 
•Derived Class SalariedEmployee:
Inheritance 
•.cpp HourlyEmployee:
Inheritance
Inheritance 
•.cpp SalariedEmployee :
Inheritance
Inheritance 
//This is the application file employee_test.cpp. 
#include <iostream> 
#include "hourlyemployee.h" 
#include "salariedemployee.h" 
using namespace std; 
using namespace SavitchEmployees; 
void showEmployeeData(const Employee object); 
int main( ) 
{ 
HourlyEmployee joe("Mighty Joe","123-45-6789", 20.50, 40); 
SalariedEmployee boss("Mr. Big Shot","987-65-4321", 10500.50); 
showEmployeeData(joe); 
showEmployeeData(boss); 
return 0; 
} 
void showEmployeeData(const Employee object) 
{ 
cout << "Name: " << object.getName( ) << endl; 
cout << "Social Security Number: " 
<< object.getSsn( ) << endl; 
} 
•.cpp Main :
Inheritance 
•If a function is defined in Parentclass and in Childclass , Then an Object from Child can reach to the function In Parentclass By this method : 
•ChildClass Object. ParentClass :: function(parameters)
Inheritance 
•CONSTRUCTORS IN DERIVED CLASSES : 
•A constructor in a base class is not inherited in the derived class, but you can invoke a constructor of the base class within the definition of a derived class constructor .
Inheritance 
•CONSTRUCTORS IN DERIVED CLASSES : 
•A constructor in a base class is not inherited in the derived class, but you can invoke a constructor of the base class within the definition of a derived class constructor . 
• constructors are called in hierarchial , from BaseClass constructors  CalledClass constructors .
Inheritance 
•CONSTRUCTORS IN DERIVED CLASSES : 
Derived::Derived(const Derived& Object) 
: Base(Object), <probably more initializations> 
{ 
... 
}
Inheritance 
•DESTRUCTOR IN DERIVED CLASSES : 
•The Destructor for the ParentClass is called automatically from the ChildClass Destructor , so just define the ChildClasses Destructors .
Inheritance 
•DESTRUCTOR IN DERIVED CLASSES : 
•The Destructor for the ParentClass are called automatically from the ChildClass Destructor , so just define the ChildClasses Destructors . 
•The Destruction is in an opposite way of the Construction!!
Inheritance 
•you cannot access a private member variable or private member function in the definition or implementation of a derived class. 
•THE protected QUALIFIER :
Inheritance 
•you cannot access a private member variable or private member function in the definition or implementation of a derived class. 
•THE protected QUALIFIER : 
•if a member is marked as protected in a base class, then it can be accessed by name in the definitions of all descendant classes, not just in those classes directly from the base class.
Inheritance 
•THE protected QUALIFIER :
Inheritance 
•NOTES : 
•Overloaded assignment operators and constructors are not inherited. 
•You have to Overload it using the operator in ParentClass like that: 
Derived& Derived::operator =(const Derived& rightSide) 
{ 
Base::operator =(rightSide); 
... 
}
Inheritance 
•NOTES : 
•It’s not necessary for ChildClass and ParentClass being from the same Namespace !
Inheritance 
•NOTES : 
•It’s not necessary for ChildClass and ParentClass being from the same Namespace ! 
•You can inherit from more one class ! 
childClass: ParentClass1, ParentClass2 {… …. }
That’s for today 
Go and Play !! 
That’s for today guys !! 
Bye Bye !
2 bytes team 
Group : group link Mobile phone- Kinan : 0994385748 Facebook account : kinan’s account 
2 bytes team

Mais conteúdo relacionado

Semelhante a 2 BytesC++ course_2014_c11_ inheritance

Object oriented programming new syllabus presentation
Object oriented programming new syllabus presentationObject oriented programming new syllabus presentation
Object oriented programming new syllabus presentation
iqraamjad1405
 

Semelhante a 2 BytesC++ course_2014_c11_ inheritance (20)

29csharp
29csharp29csharp
29csharp
 
29c
29c29c
29c
 
INHERITANCE.pptx
INHERITANCE.pptxINHERITANCE.pptx
INHERITANCE.pptx
 
Inheritance
InheritanceInheritance
Inheritance
 
full defination of final opp.pptx
full defination of final opp.pptxfull defination of final opp.pptx
full defination of final opp.pptx
 
SystemVerilog_Classes.pdf
SystemVerilog_Classes.pdfSystemVerilog_Classes.pdf
SystemVerilog_Classes.pdf
 
OOP
OOPOOP
OOP
 
Lecturespecial
LecturespecialLecturespecial
Lecturespecial
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Java(inheritance)
Java(inheritance)Java(inheritance)
Java(inheritance)
 
Object oriented programming new syllabus presentation
Object oriented programming new syllabus presentationObject oriented programming new syllabus presentation
Object oriented programming new syllabus presentation
 
Java Inheritance - sub class constructors - Method overriding
Java Inheritance - sub class constructors - Method overridingJava Inheritance - sub class constructors - Method overriding
Java Inheritance - sub class constructors - Method overriding
 
Unit 7 inheritance
Unit 7 inheritanceUnit 7 inheritance
Unit 7 inheritance
 
Inheritance.pptx
Inheritance.pptxInheritance.pptx
Inheritance.pptx
 
PPT Lecture-1.4.pptx
PPT Lecture-1.4.pptxPPT Lecture-1.4.pptx
PPT Lecture-1.4.pptx
 
Inheritance
Inheritance Inheritance
Inheritance
 
session 24_Inheritance.ppt
session 24_Inheritance.pptsession 24_Inheritance.ppt
session 24_Inheritance.ppt
 
Super Keyword in Java.pptx
Super Keyword in Java.pptxSuper Keyword in Java.pptx
Super Keyword in Java.pptx
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
Pi j3.1 inheritance
Pi j3.1 inheritancePi j3.1 inheritance
Pi j3.1 inheritance
 

Mais de kinan keshkeh

Mais de kinan keshkeh (20)

10 Little Tricks to Get Your Class’s Attention (and Hold It)
10 Little Tricks to Get Your  Class’s Attention (and Hold It)10 Little Tricks to Get Your  Class’s Attention (and Hold It)
10 Little Tricks to Get Your Class’s Attention (and Hold It)
 
Simpson and lagranje dalambair math methods
Simpson and lagranje dalambair math methods Simpson and lagranje dalambair math methods
Simpson and lagranje dalambair math methods
 
Shapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop conceptShapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop concept
 
Shapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop conceptShapes and calculate (area and contour) / C++ oop concept
Shapes and calculate (area and contour) / C++ oop concept
 
GeneticAlgorithms_AND_CuttingWoodAlgorithm
GeneticAlgorithms_AND_CuttingWoodAlgorithm  GeneticAlgorithms_AND_CuttingWoodAlgorithm
GeneticAlgorithms_AND_CuttingWoodAlgorithm
 
Algorithm in discovering and correcting words errors in a dictionary or any w...
Algorithm in discovering and correcting words errors in a dictionary or any w...Algorithm in discovering and correcting words errors in a dictionary or any w...
Algorithm in discovering and correcting words errors in a dictionary or any w...
 
2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph2Bytesprog2 course_2014_c9_graph
2Bytesprog2 course_2014_c9_graph
 
2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_units2Bytesprog2 course_2014_c8_units
2Bytesprog2 course_2014_c8_units
 
2Bytesprog2 course_2014_c7_double_lists
2Bytesprog2 course_2014_c7_double_lists2Bytesprog2 course_2014_c7_double_lists
2Bytesprog2 course_2014_c7_double_lists
 
2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list
 
2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers2Bytesprog2 course_2014_c5_pointers
2Bytesprog2 course_2014_c5_pointers
 
2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c4_binaryfiles2Bytesprog2 course_2014_c4_binaryfiles
2Bytesprog2 course_2014_c4_binaryfiles
 
2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c3_txtfiles2Bytesprog2 course_2014_c3_txtfiles
2Bytesprog2 course_2014_c3_txtfiles
 
2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c2_records2Bytesprog2 course_2014_c2_records
2Bytesprog2 course_2014_c2_records
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
 
2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets2Bytesprog2 course_2014_c1_sets
2Bytesprog2 course_2014_c1_sets
 
2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates2 BytesC++ course_2014_c13_ templates
2 BytesC++ course_2014_c13_ templates
 
2 BytesC++ course_2014_c12_ polymorphism
2 BytesC++ course_2014_c12_ polymorphism2 BytesC++ course_2014_c12_ polymorphism
2 BytesC++ course_2014_c12_ polymorphism
 

Último

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Último (20)

VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 

2 BytesC++ course_2014_c11_ inheritance

  • 1. Kinan keshkeh IT Engineering-Damascus University 3rd year Summer course- 2014 2 bytes team
  • 2. • Who has any Ques? • So Let’s Go ! • What we will take : • See a program for example. • Inheritance concept • Some NOTES !!
  • 5. Inheritance •is the process by which a new class—known as a derived class—is created from another class, called the base class
  • 6. Inheritance •is the process by which a new class—known as a derived class—is created from another class, called the base class •A derived class automatically has all the member variables and all the ordinary member functions that the base class has, and can have additional member functions and additional member variables.
  • 7. Inheritance •We have Parent class “ Vehicle” and child class “ Wheeled vehicle” and child of child “Car” . •So each “Car” is a “ Wheeled vehicle” and “Vehicle” .
  • 8. Inheritance •To derive class from base class , we write : class DerivedClass : public BaseClass{ class_members }
  • 9. Inheritance •To derive class from base class , we write : class DerivedClass : public BaseClass{ class_members } • A class that is a parent of a parent of a parent of another class, is often called an ancestor class • If class A is an ancestor of class B, then class B is often called a descendant of class A
  • 10. Inheritance •The members of the Child classes are members from the Parent classes , so any operation or any function is defined in Parent class , will be defined in Child classes .
  • 11. Inheritance •The members of the Child classes are members from the Parent classes , so any operation or any function is defined in Parent class , will be defined in Child classes . •The other way isn’t correct !!
  • 15. Inheritance •Derived Class HourlyEmployee :
  • 16. Inheritance •Derived Class SalariedEmployee:
  • 21. Inheritance //This is the application file employee_test.cpp. #include <iostream> #include "hourlyemployee.h" #include "salariedemployee.h" using namespace std; using namespace SavitchEmployees; void showEmployeeData(const Employee object); int main( ) { HourlyEmployee joe("Mighty Joe","123-45-6789", 20.50, 40); SalariedEmployee boss("Mr. Big Shot","987-65-4321", 10500.50); showEmployeeData(joe); showEmployeeData(boss); return 0; } void showEmployeeData(const Employee object) { cout << "Name: " << object.getName( ) << endl; cout << "Social Security Number: " << object.getSsn( ) << endl; } •.cpp Main :
  • 22. Inheritance •If a function is defined in Parentclass and in Childclass , Then an Object from Child can reach to the function In Parentclass By this method : •ChildClass Object. ParentClass :: function(parameters)
  • 23. Inheritance •CONSTRUCTORS IN DERIVED CLASSES : •A constructor in a base class is not inherited in the derived class, but you can invoke a constructor of the base class within the definition of a derived class constructor .
  • 24. Inheritance •CONSTRUCTORS IN DERIVED CLASSES : •A constructor in a base class is not inherited in the derived class, but you can invoke a constructor of the base class within the definition of a derived class constructor . • constructors are called in hierarchial , from BaseClass constructors  CalledClass constructors .
  • 25. Inheritance •CONSTRUCTORS IN DERIVED CLASSES : Derived::Derived(const Derived& Object) : Base(Object), <probably more initializations> { ... }
  • 26. Inheritance •DESTRUCTOR IN DERIVED CLASSES : •The Destructor for the ParentClass is called automatically from the ChildClass Destructor , so just define the ChildClasses Destructors .
  • 27. Inheritance •DESTRUCTOR IN DERIVED CLASSES : •The Destructor for the ParentClass are called automatically from the ChildClass Destructor , so just define the ChildClasses Destructors . •The Destruction is in an opposite way of the Construction!!
  • 28. Inheritance •you cannot access a private member variable or private member function in the definition or implementation of a derived class. •THE protected QUALIFIER :
  • 29. Inheritance •you cannot access a private member variable or private member function in the definition or implementation of a derived class. •THE protected QUALIFIER : •if a member is marked as protected in a base class, then it can be accessed by name in the definitions of all descendant classes, not just in those classes directly from the base class.
  • 31. Inheritance •NOTES : •Overloaded assignment operators and constructors are not inherited. •You have to Overload it using the operator in ParentClass like that: Derived& Derived::operator =(const Derived& rightSide) { Base::operator =(rightSide); ... }
  • 32. Inheritance •NOTES : •It’s not necessary for ChildClass and ParentClass being from the same Namespace !
  • 33. Inheritance •NOTES : •It’s not necessary for ChildClass and ParentClass being from the same Namespace ! •You can inherit from more one class ! childClass: ParentClass1, ParentClass2 {… …. }
  • 34. That’s for today Go and Play !! That’s for today guys !! Bye Bye !
  • 35. 2 bytes team Group : group link Mobile phone- Kinan : 0994385748 Facebook account : kinan’s account 2 bytes team