1. BABA GHULAM SHAH BADSHAH
UNIVERSITY- RAJOURI (J&K).
DEPARTMENT OF COMPUTER
SCIENCES
PRESENTATION TOPIC:-
PRESENTED BY:-
Ajeela Mushtaq Roll NO:-13-Mcs-15
PRESENTED TO:-
Mr. QAMAR RAYEES
KHAN
POLYMORPHISM.
3. ▷The word polymorphism means having
many forms.
▷Polymorphism occurs when there is a
hierarchy of classes and they are
related by inheritance.
4. Polymorphism
▷ Polymorphism is an object-oriented
programming concept that refers to the
ability of a variable, function or object to
take on multiple forms.
▷ A language that features polymorphism
allows developers to program in the
general rather than program in the
specific.Polymorphism
▷ means the ability to take more than one
form.
5.
6. ▷ Static polymorphism refers to an entity
existing in different physical forms
simultaneously.
▷ It involves of binding of function based
on the number, type and sequence of
arguments.
▷ The various types of parameters are
specified in the function can be bound to
call at compile time.
7. ▷ Early binding.
▷ When the program is executed, the calls
are already bound to the appropriate
functions.
▷ The resolution of a function call is based
on number, type and sequence of
arguments declaration for each form of
the function.
8. // function declaration
void add()
void add(int , int);
void add(float, float);
When the add() function is invoked, the
parameters passed to it will determine
which version is done at compile time.
9. ▷ If any class have multiple function
with same name but different
parameters then they are said to be
overloaded.
▷ Function overloading allows you to
use the same name for different
functions, to perform , either same or
different functions in the same class.
▷ It is usually used to enhance the
readability of the program.
12. ▷ Operator overloading is an important
concept in C++. It is a type of
polymorphism in which an operator is
overloaded to give user defined meaning
to it.
▷ Overloaded operator is used to perform
operation on user-defined data type.
▷ For example '+' operator can be
overloaded to perform addition on various
data types, like for Integer,
String(concatenation) etc.
13. ▷ Almost any operator can be
overloaded in C++. However there are
few operator which can not be
overloaded.Operator that are not
overloaded are follows
▷ scope operator - ::
▷ sizeof
▷ member selector - .
▷ member pointer selector - *
▷ ternary operator - ?:
14. Run Time Polymorphism:
▷ C++ allows binding to be delayed till run
time. When you have a function with same
name, equal number of arguments and
same data type in same sequence in base
class as well derived class and a function
call of form:
base_class_type_ptr-
>member_function(args);
will always call base class member function.
▷ The keyword virtual on a member function
in base class indicates to the compiler to
delay the binding till run time..
15. ▷ Every class with at least one virtual
function has a table that helps in
binding at run time. Looking at the
content of base class type pointer it
will correctly call the member function
of one of possible derived / base
class member function