1.5.4. Inheritance:-: Bird Attributes
1.5.4. Inheritance:-: Bird Attributes
1.5.4. Inheritance:-: Bird Attributes
Inheritance:-
Bird
Attributes:
Feathers
Lay eggs
Flying Nonflying
Bird Bird
Attributes: Attributes:
1
In OOP, the concept of inheritance provides the idea of “reusability”.
This means that we can add additional features to an existing class
without modifying it. This is possible by deriving a new class will have
the combined features of both the classes.
1.5.5 polymorphism:-
Shape
Draw ( )
2
Polymorphism plays an important role in allowing objects having
different internal structures to share the same external interface. This
means that a general class of operations may be accessed in the same
manner even though specific actions associated with each operation
may differ.
Polymorphism is extensively used in implementing “inheritance “.
3
Objects communicate with one another by sending and receiving
information much the same way as people pass messages to one
another.
A message for an object is a request for execution of a procedure, and
therefore will invoke a function (procedure) in the receiving object that
generates the desired result.
Message passing involves specifying the name of the object the name of
the function message and the information to be sent. Example:
object information
message
4
1.6 Benefits of OOP:-
OOP offers several benefits to both the program designer and the user.
Object-orientation contributes to the solution of many problems
associated with the development and quality of s/w products. The
principal advantages are: