#include<iostream.h>
#include<conio.h>
int p=1000,t=1;
class bank
{
public:
                virtual void interest()=0;               //Pure Virtual Function
};
void bank::interest()
{
                cout<<"The Home Loan : ";
}
class sbi:public bank
{
                int i;
public:
                void interest()
                                {
                                i=(p*5*t)/100;
                                cout<<"SBI Interest Is : "<<i<<endl;
                                }
};
class pnb:public bank
{
                int i;
public:
                void interest()
                                {
                                i=(p*7*t)/100;
                                cout<<"PNB Interest Is : "<<i<<endl;
                                }
};
void main()
{
                clrscr();
                bank *b;
                sbi s;
                b=&s;
                b->interest();     //Late Binding
                pnb p;
                b=&p;
                b->interest();     //Late Binding
                getch();
}

200.PNG

Advertisements