Programming Inheritance

Inheritance

            is the mechanism which allows a class B (child/sub/derived ) to inherit properties from class A(parent /super/base )

                                    A<———B

                                                or

            it's the process of creating new classes (derived class) from existing classes(base), the derived class inherit all the capabilities of base class but can add embellishement & refinements of it's own,,,,,,,,

            the bug payoff of the inheritance is that it permits code reusability….example of reusibility is iostream class which we use again & again

            inheritance s the most power ful feature of oop after classes themselves, for inh there must be two classes at least

Types Of Inheritance

inheritance s the relationhip among classes….

1.  A KIND OF RELATIONSHIP

            simple relationship among classes

2.  IS A RELATIONSHIP

            simple relationship among objects

3. PART OF RELATIONSHIP

            aggregation relationship , one class can be fitted in to another class….

            e,g    oneC——->corrola

4. HAS A RELATIONSHIP

            aggreagation relationship

            e,g    oneC<——-corrola

Access Specifier

            1. private :: inside class accessable not out side class

            2. public ::  inside class accessable also out side class

            3. protected: inside class accessable not out side BUT can be accessable outsideclass f inheritance

Function Overriding

            same func name n different classes……

            same arguments n func

            same func name

BUT in OVERLOADING

            same func name n same class

            different arguments

            same func name….

Level Of Onheritance

            there s no limit of child classes

Multiple Inheritance

            one child have multiple parentd