C++ Logo.wine
C++

What is dynamic binding in c++? with example

polymorphism is the ability to use an operator or function in different ways. Polymorphism gives different meanings to the operator or functions. Poly, referring to-many, signifies the many use of these operators and functions. A single function usage in many forms or an operator functioning in many ways can be called polymorphism.

For example:-
#include<iostream.h>
#include<conio.h>
classpixeles
{
public:
virtual void disp()
{
cout<<“PIXELES CLASSES FOR BCA & MCA” ;
}
};
classindia : public pixeles
{
public:
voiddisp()
{
cout<<“\n A SUCCESS KEY”;
}
};
class success : public pixeles
{
public:
voiddisp()
{
cout<<“\n www.pixelesindia.com”;
}
};
void main()
{
clrscr();
pixeles op;
indiapp;
successll;
op.disp();
pp.disp();
ll.disp();
pixeles *h;
h=&op;
h->disp();
h=&pp;
h->disp();
h=&ll;
h->disp();
getch();
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.