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

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Recently uploaded (20)

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

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.