Page 175 - DCAP404 _Object Oriented Programming
P. 175

Object-oriented Programming                                    Sahil Rampal, Lovely Professional University




                    Notes                                   Unit 9: Inheritance


                                     CONTENTS
                                     Objectives
                                     Introduction
                                     9.1  Defining Derived Class

                                     9.2  Forms of Inheritance
                                          9.2.1  Single Inheritance
                                          9.2.2  Multilevel  Inheritance
                                          9.2.3  Multiple Inheritance
                                          9.2.4  Hierarchical Inheritance

                                          9.2.5  Hybrid Inheritance
                                     9.3  Ambiguity in Multiple and Multipath Inheritance
                                          9.3.1  Ambiguity in Multiple Inheritance
                                          9.3.2  Ambiguity in Multipath Inheritance
                                     9.4  Virtual Base Classes
                                     9.5  Overriding Member Function

                                     9.6  Constructors under Inheritance
                                     9.7  Destructors under Inheritance
                                     9.8  Making a Private Member Inheritable
                                     9.9  Summary
                                     9.10 Keywords

                                     9.11 Review Questions
                                     9.12 Further Readings

                                  Objectives

                                  After studying this unit, you will be able to:
                                      Recognize the inheritance

                                      Describe the different types of inheritance
                                      Explain the ambiguity in multiple and multipath inheritance
                                      Discuss the virtual base class

                                      Identify the overriding member function
                                      Demonstrate the execution of constructor and destructor with inheritance
                                  Introduction


                                  Reusability of code is a characteristic feature of OOP.  C++ strongly supports the concept of
                                  reusability. The C++ classes can be used again in several ways. Once a class has been written and



          168                               LOVELY PROFESSIONAL UNIVERSITY
   170   171   172   173   174   175   176   177   178   179   180