#include<iostream.h>
#include<conio.h>
class A
{
public:
virtual void show()
{
cout<<"Hello"<<endl;
}
void show1()
{
cout<<"show-1"<<endl;
}
};
class B:public A //public visibility mode of inhe.
{
public:
void show()
{
cout<<"India"<<endl;
}
void display()
{
cout<<"Display"<<endl;
}
};
int main()
{
clrscr();
A *a1=new B; //Super class or base class pointer can point subclass object
a1->show();
A *a;
B b;
a=&b;
a->show();
//a->display();
a->show1();
B *b1=new B;
b1->show();
b1->show1();
b1->display();
getch();
return 0;
}
No comments:
Post a Comment