SlideShare a Scribd company logo
1 of 40
Inheritance It is the mechanism of deriving  new class from existing class.It provides the idea of reusability. A B Base , super,parent class derived , sub, child class
Types of inheritance ,[object Object],B A Multilevel Multiple Hierarchical hybrid B A C A B C A B A C A D A E F A G H I J B A C B A B C C
[object Object],[object Object],[object Object]
syntax ,[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Class der2:private base { Public: Void get() { Int p; p=x;  //error not accessible p=y;  // ok  p=z;  //ok } }; Void main() { Int M; der1 d1; M=d1.x;  //error M=d1.y;  //error M=d1.z;  //ok der2 d2; M=d2.x;  //error M=d2.y;  // error M=d2.z;  //error }
Single level inheritance ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Class derived:public base { Int y; Public: Get_derived(int a) { y=a; } Display_derived() { Cout<<“y=“<<y; } }; Void main() { derived d; d.Get_base(10); d.Dispaly_base(); d.Get_derived(20); d.Dispaly_derived(); }
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Class derived:public base { Int y; Public: Get_derived(int a) { Get_base(40); y=a; } Display_derived() { Display_base(); Cout<<“y=“<<y; } }; Void main() { derived d; d.Get_derived(10); d.Dispaly_derived(); }
Private inheritance ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Class derived:private base { }; Void main() { derived d; d.Dispaly_base(); } o/p ------  error
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Class derived:private base { Int y; Public: Get_derived(int a) { Get_base(20); y=a; } Display_derived() { Display_base(); Cout<<“y=“<<y; } }; Void main() { derived d; d.Get_derived(10); d.Dispaly_derived(); }
Function overriding
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Class derived:public base { Int y; Public: Getdata(int a) { y=a; } Display() { Cout<<“y=“<<y; } }; Void main() { derived d; d.Getdata(); d.Dispaly(); } o/p---  y =
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],void main() { Volume v; v.get(); v.cal_volume(); }
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],void main() { Volume v; v.get(); Int vol=length*height*width; Cout<<“volume=“<<vol; } o/p === error (protected member can be  accessed  in that class and in derived class not in main)
Multilevel inheritance ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Class third:public second { Public: Display3() { Cout<<“third class”; } }; Void main() { third t; t.Display1(); t.Display2(); t.Display3(); }
Multiple inheritance ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Class result:public super,public:sub { Public: Void show() { getbase(); getpower(); Int t=1; for(int i=1;i<=power;i++) { t=t*base; } Cout<<“base=“<<base; Cout<<“power=“<<power; Cout<<“output result=“<<t; } }; Void main() { Result t; t.show(); }
Hierarchical inheritance a b c d e f g h i j
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Class college2: public university { Protected: Char college_name[20]; Public: college2() { Strcpy(college_name,”A.I.E.T”); } Void display2() { Cout<<“college name=<<college_name; Cout<<“university name=<<uname; } }; Void main() { University u; u.getuniversity(); College1 c1; C1.display1(); College2 c2; C2.display2(); }
Hybrid ,[object Object],Test sports result
[object Object],class sports { protected: float score; public: void getscore() { cout< < endl< < &quot;Enter your score :&quot;; cin>>score; } void putscore() { cout< < score< < &quot;&quot;; } }; class results : public test , public sports { private : float total; public : void putresult() { total = m1+m2+score; cout< < total; } };
[object Object]
2nd example of hybrid: ,[object Object],[object Object],[object Object],[object Object],[object Object],Animals Mammals Reptiles Snakes
SOLUTION OF IT: VIRTUAL ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],VIRTUAL BASE CLASS class a { }; class b:public  virtual  a { }; class c: virtual  public a {  }; class d: public b, public c { }; B and C share the same subobject of A.  Using the keyword virtual in this  example ensures that an object of class D inherits only one subobject of class A  //ERROR
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Void main() { D obj; Obj.show(); } o/p:  It is base class
Constructor and destructor in inheritance ,[object Object],[object Object]
Constructor and destructor in inheritance ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Void main() { Derived d; } O/P  it is base class it is derived class
Destructor in inheritance ,[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Void main() { Derived d; } o/p :  it is base class constructor it is derived class constructor it is derived class destructor it is base class destructor
Explicitly calling constructor ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],~derived() { Cout<<“it is derived class destructor<<endl”; } }; Void main() { Derived d; } o/p :  it is base class constructor it is derived class constructor it is derived class destructor it is base class destructor
Constructor  and destructor in  multilevel
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Class derived2:public derived1 { Public: derived() { Cout<<“it is derived2 class constructor <<endl”; } ~derived() { Cout<<“it is derived2 class destructor <<endl”; } }; Void main() { Derived2  obj; } o/p: it is base class constructor it is derived1 class constructor it is derived2 class constructor it is derived2 class destructor it is derived1 class destructor it is base class destructor
Constructor  and destructor in  multiple inheritance Constructor is called in the sequence of inheritance Class  a { }; Class b { }; Class c: public b,public a { }; Then  first  constructor of  b  then of  a  is called
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Class derived:public base2,public base1 { Public: derived() { Cout<<“it is derived class constructor <<endl”; } }; Void main() { Derived d; } o/p: it is base2 class constructor it is base1 class constructor it is derived class constructor
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Class derived:public  base2, public base1 { Public: derived():base1(), base2() { Cout<<“it is derived class constructor <<endl”; } }; Void main() { Derived d; } o/p: it is base2 class constructor it is base1 class constructor it is derived class constructor Same output even done explicit calling
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Void main( ) { Derived d(20,30); } o/p  X=20 Y=30
Initialize the values of data members from constructor  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Void main() { Demo d; }
Containership ,[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Void main() { Lower l; } o/p hello
[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Void main() { lower l; } o/p it is upper class constructor it is lower class constructor

More Related Content

What's hot (20)

Inheritance in c++theory
Inheritance in c++theoryInheritance in c++theory
Inheritance in c++theory
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance
InheritanceInheritance
Inheritance
 
Friend functions
Friend functions Friend functions
Friend functions
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
Inheritance in C++
Inheritance in C++Inheritance in C++
Inheritance in C++
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
inheritance in C++
inheritance in C++inheritance in C++
inheritance in C++
 
Multiple inheritance in c++
Multiple inheritance in c++Multiple inheritance in c++
Multiple inheritance in c++
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
Inheritance
InheritanceInheritance
Inheritance
 
Single inheritance
Single inheritanceSingle inheritance
Single inheritance
 
Inheritance, polymorphisam, abstract classes and composition)
Inheritance, polymorphisam, abstract classes and composition)Inheritance, polymorphisam, abstract classes and composition)
Inheritance, polymorphisam, abstract classes and composition)
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)Inheritance In C++ (Object Oriented Programming)
Inheritance In C++ (Object Oriented Programming)
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance in C++
Inheritance in C++Inheritance in C++
Inheritance in C++
 
Introduction to Inheritance
Introduction to InheritanceIntroduction to Inheritance
Introduction to Inheritance
 
00ps inheritace using c++
00ps inheritace using c++00ps inheritace using c++
00ps inheritace using c++
 

Viewers also liked

Mitosis & meiosis review
Mitosis & meiosis reviewMitosis & meiosis review
Mitosis & meiosis reviewabicher
 
Analog Transmission And Error Detection
Analog Transmission And Error Detection Analog Transmission And Error Detection
Analog Transmission And Error Detection Md Nazrul Islam Roxy
 
Structurs of dna and rna
Structurs of dna and rnaStructurs of dna and rna
Structurs of dna and rnaGayathri91098
 
Patterns Of Inheritance Modified
Patterns Of Inheritance ModifiedPatterns Of Inheritance Modified
Patterns Of Inheritance ModifiedKillester
 
Multiple allelism
Multiple allelism Multiple allelism
Multiple allelism Neha Mahor
 
Sex-linked inheritance by Puzon and Tope
Sex-linked inheritance by Puzon and TopeSex-linked inheritance by Puzon and Tope
Sex-linked inheritance by Puzon and TopeKathleen Faye Puzon
 
Mitosis and meiosis
Mitosis and meiosisMitosis and meiosis
Mitosis and meiosisKarl Pointer
 
Error Detection And Correction
Error Detection And CorrectionError Detection And Correction
Error Detection And CorrectionRenu Kewalramani
 
Biology - Chp 11 - Introduction To Genetics - PowerPoint
Biology - Chp 11 - Introduction To Genetics - PowerPointBiology - Chp 11 - Introduction To Genetics - PowerPoint
Biology - Chp 11 - Introduction To Genetics - PowerPointMr. Walajtys
 

Viewers also liked (11)

Mitosis & meiosis review
Mitosis & meiosis reviewMitosis & meiosis review
Mitosis & meiosis review
 
Analog Transmission And Error Detection
Analog Transmission And Error Detection Analog Transmission And Error Detection
Analog Transmission And Error Detection
 
Genitics
GeniticsGenitics
Genitics
 
Structurs of dna and rna
Structurs of dna and rnaStructurs of dna and rna
Structurs of dna and rna
 
Patterns Of Inheritance Modified
Patterns Of Inheritance ModifiedPatterns Of Inheritance Modified
Patterns Of Inheritance Modified
 
Multiple allelism
Multiple allelism Multiple allelism
Multiple allelism
 
Sex-linked inheritance by Puzon and Tope
Sex-linked inheritance by Puzon and TopeSex-linked inheritance by Puzon and Tope
Sex-linked inheritance by Puzon and Tope
 
Sex Linked Inheritance
Sex Linked InheritanceSex Linked Inheritance
Sex Linked Inheritance
 
Mitosis and meiosis
Mitosis and meiosisMitosis and meiosis
Mitosis and meiosis
 
Error Detection And Correction
Error Detection And CorrectionError Detection And Correction
Error Detection And Correction
 
Biology - Chp 11 - Introduction To Genetics - PowerPoint
Biology - Chp 11 - Introduction To Genetics - PowerPointBiology - Chp 11 - Introduction To Genetics - PowerPoint
Biology - Chp 11 - Introduction To Genetics - PowerPoint
 

Similar to inhertance c++

Similar to inhertance c++ (20)

Inheritance.pptx
Inheritance.pptxInheritance.pptx
Inheritance.pptx
 
C++ polymorphism
C++ polymorphismC++ polymorphism
C++ polymorphism
 
Lecture4
Lecture4Lecture4
Lecture4
 
Lecture4
Lecture4Lecture4
Lecture4
 
chapter-10-inheritance.pdf
chapter-10-inheritance.pdfchapter-10-inheritance.pdf
chapter-10-inheritance.pdf
 
OOPS IN C++
OOPS IN C++OOPS IN C++
OOPS IN C++
 
Inheritance
InheritanceInheritance
Inheritance
 
Lecture 5 Inheritance
Lecture 5 InheritanceLecture 5 Inheritance
Lecture 5 Inheritance
 
Lab3
Lab3Lab3
Lab3
 
inheritance in OOPM
inheritance in OOPMinheritance in OOPM
inheritance in OOPM
 
Lecture 6, c++(complete reference,herbet sheidt)chapter-16
Lecture 6, c++(complete reference,herbet sheidt)chapter-16Lecture 6, c++(complete reference,herbet sheidt)chapter-16
Lecture 6, c++(complete reference,herbet sheidt)chapter-16
 
OOP Lab Report.docx
OOP Lab Report.docxOOP Lab Report.docx
OOP Lab Report.docx
 
Inheritance_with_its_types_single_multi_hybrid
Inheritance_with_its_types_single_multi_hybridInheritance_with_its_types_single_multi_hybrid
Inheritance_with_its_types_single_multi_hybrid
 
C++ Inheritance
C++ InheritanceC++ Inheritance
C++ Inheritance
 
C++ prgms 4th unit Inheritance
C++ prgms 4th unit InheritanceC++ prgms 4th unit Inheritance
C++ prgms 4th unit Inheritance
 
Inheritance compiler support
Inheritance compiler supportInheritance compiler support
Inheritance compiler support
 
Inheritance
InheritanceInheritance
Inheritance
 
MODULE2_INHERITANCE_SESSION1.ppt computer
MODULE2_INHERITANCE_SESSION1.ppt computerMODULE2_INHERITANCE_SESSION1.ppt computer
MODULE2_INHERITANCE_SESSION1.ppt computer
 
OOPS Basics With Example
OOPS Basics With ExampleOOPS Basics With Example
OOPS Basics With Example
 
Unit 4
Unit 4Unit 4
Unit 4
 

Recently uploaded

Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 

Recently uploaded (20)

Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 

inhertance c++

  • 1. Inheritance It is the mechanism of deriving new class from existing class.It provides the idea of reusability. A B Base , super,parent class derived , sub, child class
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17. Hierarchical inheritance a b c d e f g h i j
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30. Constructor and destructor in multilevel
  • 31.
  • 32. Constructor and destructor in multiple inheritance Constructor is called in the sequence of inheritance Class a { }; Class b { }; Class c: public b,public a { }; Then first constructor of b then of a is called
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.