INHERITANCE inheritance inheritance is the capacity of one

  • Slides: 6
Download presentation
INHERITANCE

INHERITANCE

inheritance Ø inheritance is the capacity of one class to inherited properties from another

inheritance Ø inheritance is the capacity of one class to inherited properties from another class. Base class: Ø The class propertics are inherited by another class. Derived class: Ø The class that inherited the propertics from base class. Syntex: Ø Class derived class name : visibility mode base class name. { Member function of derived class.

Advantages of inheritance Ø Ø Reusing existing point. Factor deveiopment time. Easy to maintain.

Advantages of inheritance Ø Ø Reusing existing point. Factor deveiopment time. Easy to maintain. Me. mary utilisatin. Inheritance can be classified into 5 times. 1 Single level inheritance. Ø Single inheritance enables a derived class to inherit properties and behavior from a single parent class.

2. Multi level inheritance. Ø nheritance is the process of inheriting properties of objects

2. Multi level inheritance. Ø nheritance is the process of inheriting properties of objects of one class by objects of another class. . When a class is derived from a class which is also derived from another class, i. e. a class having more than one parent classes, such inheritance is called Multilevel Inheritance. 3. Multipal level inheritance. The multiple inheritance is a feature of C++ where a class can inherit from more than one class i. e. one sub class is inherited from more than one base class. In this type of inheritance a single child class can have multiple parent classes.

4. Hierarchical Inheritance. Ø When more than one classes are derived from a single

4. Hierarchical Inheritance. Ø When more than one classes are derived from a single base class, such inheritance is known as Hierarchical Inheritance, where features that are common in lower level are included in parent class. Hybrid inheritance. Ø Thatis a combination of multiple inheritance and multilevel inheritance. A class is derived from two classes as in multiple inheritance. However, one of the parent classes is not a base class. It is a derived class.

Thank you

Thank you