#include<iostream>
using namespace std;
class Animal{
public:
int a,b;
virtual void speak()
{
cout<<"My name is Animal."<<endl;
}
};
class Cat:public Animal{
public:
void speak()
{
cout<<"Ny name is "<<"cat"<<endl;
}
};
class Leopard:public Animal
{
public:
void speak()
{
cout<<"My name is "<<"Leopard"<<endl;
}
};
int main()
{
Animal* a;
Cat c1;
a=&c1;
a->speak();
Leopard l;
a=&l;
a->speak();
return 0;
}