1. TOPIC- InheritanceTOPIC- Inheritance
Inheritance process of creating aInheritance process of creating a
new class from an existing class.new class from an existing class.
• The existing class that is beingThe existing class that is being
inherited is called the base classinherited is called the base class
and new class that inherits theand new class that inherits the
functionality is called derivedfunctionality is called derived
class.class.
2. SINGLE
INHERITANCE :-
• The derived class inherits some or all
of the traits of the base class .A
class can also inherit properties from
more than one class or from more
than one level .A derived class can
only one base case is called singel
inheritance .
3.
4. MULTI LEVEL
INHERITANCE :-
• In this type of inheritance, there are
number of levels and it is used in
that cases where we want to use all
properties in number of levels
according to the requirement . It is
not unusual that a class is derived
from another derived class .
5.
6. MULTIPLE
INHERITANCE:-
• A class can inherit the attributes of two
or more classes . This is known as multiple
iheritance . Multiple inheritance allows us
to join the features of a number of exiting
classes as a starting point for defining new
classes . It is like a child inheriting the
physical features of one parent and the
intellectuality of other .
7.
8. HIERARCHICAL
INHERITANCE :-
• The form in which more then one classes
are derived from single base class is know
as hierarchical inheritance . Hierarchical
inheritance is useful in the cases where
there is some hierarchical content in
program . We can cast a number of
problems into hierarchical manner , and
therefore will use hierarchical inheritance
there .
9.
10. HYBRID
INHERITANCE :-
• In this type of inheritance , we can
have combination of two or more
types . It is when you want to use two
or more type of inheritance in a
single program . Thus , hybrid
iheritance is that from of
inheritance in which we use two or
more than two types of inheritance .
11.
12. PUBLIC,PRIVATE AND
PROTECTED INHERITANCE
• Inheritance is a process of creating a new class from
an existing class. When a class is derived from an
existing class, all the members of base class are
automatically inherited in the derived class. However,
it is also possible to restrict access to data members
and member functions of the base class in the
derived class.
• The purpuse of restricting access to member of the
base class is to ensure the integrity of the object by
controlling how other classes and parts of the
program(main()) interact
with it.
13. • In order to achieve this, the base class
is inherited through public, private and
protected access specifiers.these
specifies control the access of
inherited members of the base class in
the derived class and other parts of the
programmain().