Define polymorphism and also discuss their type(BCA 3 - sem)


 Definition of Polymorphism:-

Polymorphism define many from of a function in C++ language because  it is basic concept of a oops. Enable to some function with different behaviour is class. OOPS concept time or run time data binding with the help of oops use in oops with the help of C++ program.

A). Compile time Polymorphism

B). Run time Polymorphism


Read Also- Define Reduce instruction set computer& complex instruction set computer(BCA-3 sem)

Definition of Compile time:-

The overloading member function use  to select by matching argument  both of the type and function. it is also known as static binding in object oriented programming system. and static member function class. there are two types of compile time polymorphism.

1). Function overloading

2). Operator overloading

          Syntex:

                                  Class P

                                }

                                 int x

                                 public:

                                       void (show);

                                   };

                                Class R : : Public P

                                {

                                };

 Definition of Run time:

In run time polymorphism the virtual function use of some function name and both of the base  class 
and derived class. It is also known as Run time polymorphism & Dynamic binding. The link between run time and compile time function. it is denote by the function as a virtual  function.

    Syntax:

                      Class base

                                 {

                                 int x ;

                                 public :

                                       virtual void show ();

                                  }

                                    class derived : : public base

                                   {

                                      int y ;

                                      public :

                                          void show ();

                                 };

No comments:

Post a Comment

If you have any doubts, Please lets me know and Please Follow our Website