/*polymorphism in c++
*********************/
/* poly= many morph=forms
when one thing has many forms it is known as polymorphism. and also the process of representing
the one thing in multiple form is known as polymorphism.real life example for polymorphysim is that
you are the person suppose you are in a class rommthat time you behave like student, in a markeet
bahaves like a customer, in a home behaves like a son/doughter.here one person have different
behaviors. polymorphism means more then one function with same name and different working.there
are two type of polymorphysim.
1.static polymorphysim 2. Dynamic polymorphysim
1. ststic polymorphysim
static polymorphysim is also known as early binding polymorphysim or compile time polymorphysim.
in static polymorphysim memory will be allocated at compile time.function overloading and operator
overloading are an example of static polymorphysim.in this method object is bound to the function
call at compile time.in c++ programming compile time polymorphysim can be achieve in two ways.
1.method overloading 2.method overriding 3.operator overloading
Dynamic polymorphysim
Dynamic polymorphysim is also known as late binding polymorphysim or run time polymorphysim.
in Dynamic polymorphysim memory will be allocated at run time.virtual functions are an example of
Dynamic polymorphysim.in this method object is bound to the function call at run time.Dynamic
polymorphysim can be achieve using:
1.virtual function */
No comments:
Post a Comment