#include<iostream.h>
#include<conio.h>
class Base
{
public:
virtual void display()
{
cout<<"\n I am Base Class Display";
}
};
class Derived:public Base
{
public:
void display()
{
cout<<"\n I am Derived Class Display";
}
};
void main()
{
Base *b;
clrscr();
b=new Base;
b->display();
b=new Derived;
b->display();
getch();
}
#include<conio.h>
class Base
{
public:
virtual void display()
{
cout<<"\n I am Base Class Display";
}
};
class Derived:public Base
{
public:
void display()
{
cout<<"\n I am Derived Class Display";
}
};
void main()
{
Base *b;
clrscr();
b=new Base;
b->display();
b=new Derived;
b->display();
getch();
}
No comments:
Post a Comment